File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ export class ProcessService implements IProcessService {
2222
2323 // Always ensure we have unbuffered output. 
2424 spawnOptions . env . PYTHONUNBUFFERED  =  '1' ; 
25+  if  ( ! spawnOptions . env . PYTHONIOENCODING )  { 
26+  spawnOptions . env . PYTHONIOENCODING  =  'utf-8' ; 
27+  } 
2528
2629 const  proc  =  spawn ( file ,  args ,  spawnOptions ) ; 
2730 let  procExited  =  false ; 
@@ -78,7 +81,9 @@ export class ProcessService implements IProcessService {
7881
7982 // Always ensure we have unbuffered output. 
8083 spawnOptions . env . PYTHONUNBUFFERED  =  '1' ; 
81- 
84+  if  ( ! spawnOptions . env . PYTHONIOENCODING )  { 
85+  spawnOptions . env . PYTHONIOENCODING  =  'utf-8' ; 
86+  } 
8287 const  proc  =  spawn ( file ,  args ,  spawnOptions ) ; 
8388 const  deferred  =  createDeferred < ExecutionResult < string > > ( ) ; 
8489 const  disposables : Disposable [ ]  =  [ ] ; 
Original file line number Diff line number Diff line change @@ -32,6 +32,16 @@ suite('ProcessService', () => {
3232 expect ( result . stderr ) . to . equal ( undefined ,  'stderr not undefined' ) ; 
3333 } ) ; 
3434
35+  test ( 'exec should output print unicode characters' ,  async  ( )  =>  { 
36+  const  procService  =  new  ProcessService ( new  BufferDecoder ( ) ) ; 
37+  const  printOutput  =  'öä' ; 
38+  const  result  =  await  procService . exec ( pythonPath ,  [ '-c' ,  `print(u"${ printOutput }  ] ) ; 
39+ 
40+  expect ( result ) . not . to . be . an ( 'undefined' ,  'result is undefined' ) ; 
41+  expect ( result . stdout . trim ( ) ) . to . be . equal ( printOutput ,  'Invalid output' ) ; 
42+  expect ( result . stderr ) . to . equal ( undefined ,  'stderr not undefined' ) ; 
43+  } ) ; 
44+ 
3545 test ( 'exec should wait for completion of program with new lines' ,  async  function  ( )  { 
3646 // tslint:disable-next-line:no-invalid-this 
3747 this . timeout ( 5000 ) ; 
                         You can’t perform that action at this time. 
           
                  
0 commit comments