File tree 1 file changed +10
-2
lines changed
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ export interface SSHExecCommandOptions {
43
43
stdin ?: string | stream . Readable
44
44
execOptions ?: ExecOptions
45
45
encoding ?: BufferEncoding
46
+ noTrim ?: boolean
46
47
onChannel ?: ( clientChannel : ClientChannel ) => void
47
48
onStdout ?: ( chunk : Buffer ) => void
48
49
onStderr ?: ( chunk : Buffer ) => void
@@ -417,11 +418,18 @@ export class NodeSSH {
417
418
signal = signal_ ?? null
418
419
} )
419
420
channel . on ( 'close' , ( ) => {
421
+ let stdout = output . stdout . join ( '' )
422
+ let stderr = output . stderr . join ( '' )
423
+ if ( options . noTrim !== true ) {
424
+ stdout = stdout . trim ( )
425
+ stderr = stderr . trim ( )
426
+ }
427
+
420
428
resolve ( {
421
429
code : code != null ? code : null ,
422
430
signal : signal != null ? signal : null ,
423
- stdout : output . stdout . join ( '' ) . trim ( ) ,
424
- stderr : output . stderr . join ( '' ) . trim ( ) ,
431
+ stdout : stdout ,
432
+ stderr : stderr ,
425
433
} )
426
434
} )
427
435
} )
You can’t perform that action at this time.
0 commit comments