File tree 2 files changed +5
-3
lines changed
2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -15,9 +15,10 @@ export class ProcessService implements IProcessService {
15
15
constructor ( @inject ( IBufferDecoder ) private decoder : IBufferDecoder ) { }
16
16
public execObservable ( file : string , args : string [ ] , options : SpawnOptions = { } ) : ObservableExecutionResult < string > {
17
17
const encoding = options . encoding = typeof options . encoding === 'string' && options . encoding . length > 0 ? options . encoding : DEFAULT_ENCODING ;
18
+ delete options . encoding ;
18
19
const spawnOptions = { ...options } ;
19
20
if ( ! spawnOptions . env || Object . keys ( spawnOptions ) . length === 0 ) {
20
- spawnOptions . env = process . env ;
21
+ spawnOptions . env = { ... process . env } ;
21
22
}
22
23
23
24
// Always ensure we have unbuffered output.
@@ -74,9 +75,10 @@ export class ProcessService implements IProcessService {
74
75
}
75
76
public async exec ( file : string , args : string [ ] , options : SpawnOptions = { } ) : Promise < ExecutionResult < string > > {
76
77
const encoding = options . encoding = typeof options . encoding === 'string' && options . encoding . length > 0 ? options . encoding : DEFAULT_ENCODING ;
78
+ delete options . encoding ;
77
79
const spawnOptions = { ...options } ;
78
80
if ( ! spawnOptions . env || Object . keys ( spawnOptions ) . length === 0 ) {
79
- spawnOptions . env = process . env ;
81
+ spawnOptions . env = { ... process . env } ;
80
82
}
81
83
82
84
// Always ensure we have unbuffered output.
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ suite('ProcessService', () => {
35
35
test ( 'exec should output print unicode characters' , async ( ) => {
36
36
const procService = new ProcessService ( new BufferDecoder ( ) ) ;
37
37
const printOutput = 'öä' ;
38
- const result = await procService . exec ( pythonPath , [ '-c' , `print(u "${ printOutput } ")` ] ) ;
38
+ const result = await procService . exec ( pythonPath , [ '-c' , `print("${ printOutput } ")` ] ) ;
39
39
40
40
expect ( result ) . not . to . be . an ( 'undefined' , 'result is undefined' ) ;
41
41
expect ( result . stdout . trim ( ) ) . to . be . equal ( printOutput , 'Invalid output' ) ;
You can’t perform that action at this time.
0 commit comments