@@ -2,10 +2,10 @@ import type {
22 ChildProcess ,
33 SpawnSyncOptionsWithStringEncoding ,
44} from 'child_process' ;
5+ import { getDockerEnvironment , getEditorConfiguration } from './editorConfig' ;
56import { processNotification } from './notificationChannels' ;
67import type { AsyncDisposable , ClassConfig } from './types' ;
7- import { getEditorConfiguration } from './editorConfig' ;
8- import { execute , wait } from '../../../shared/util' ;
8+ import { docker , wait } from '../../../shared/util' ;
99import { debug , sanitizeFilePath } from './debug' ;
1010import { exec , spawn } from 'child_process' ;
1111import { default as psTree } from 'ps-tree' ;
@@ -85,15 +85,19 @@ export class Process implements AsyncDisposable {
8585
8686 private static async _getDockerChildPids (
8787 containerName : string ,
88- pid : number
88+ pid : number ,
89+ classConfig : ClassConfig
8990 ) : Promise < number [ ] > {
90- const result = await execute ( 'docker' , [
91- 'exec' ,
92- containerName ,
93- 'sh' ,
94- '-c' ,
95- "ls /proc | grep -E '^[0-9]+$' | xargs -I{} cat /proc/{}/stat" ,
96- ] ) ;
91+ const result = await docker (
92+ [
93+ 'exec' ,
94+ containerName ,
95+ 'sh' ,
96+ '-c' ,
97+ "ls /proc | grep -E '^[0-9]+$' | xargs -I{} cat /proc/{}/stat" ,
98+ ] ,
99+ await getDockerEnvironment ( classConfig )
100+ ) ;
97101 if ( ! result . stdout ) {
98102 return [ ] ;
99103 }
@@ -267,16 +271,17 @@ export class Process implements AsyncDisposable {
267271 . dockerContainerName ;
268272 const pids = [
269273 pid ,
270- ...( await Process . _getDockerChildPids ( containerName , pid ) ) ,
271- ] ;
272- return pids . map ( ( pid ) =>
273- execute ( 'docker' , [
274- 'exec' ,
274+ ...( await Process . _getDockerChildPids (
275275 containerName ,
276- 'kill' ,
277- '-9' ,
278- pid . toString ( ) ,
279- ] ) . then ( ( ) => undefined )
276+ pid ,
277+ this . _classConfig
278+ ) ) ,
279+ ] ;
280+ return pids . map ( async ( pid ) =>
281+ docker (
282+ [ 'exec' , containerName , 'kill' , '-9' , pid . toString ( ) ] ,
283+ await getDockerEnvironment ( this . _classConfig )
284+ ) . then ( ( ) => undefined )
280285 ) ;
281286 }
282287
0 commit comments