@@ -2,10 +2,10 @@ import type {
2
2
ChildProcess ,
3
3
SpawnSyncOptionsWithStringEncoding ,
4
4
} from 'child_process' ;
5
+ import { getDockerEnvironment , getEditorConfiguration } from './editorConfig' ;
5
6
import { processNotification } from './notificationChannels' ;
6
7
import type { AsyncDisposable , ClassConfig } from './types' ;
7
- import { getEditorConfiguration } from './editorConfig' ;
8
- import { execute , wait } from '../../../shared/util' ;
8
+ import { docker , wait } from '../../../shared/util' ;
9
9
import { debug , sanitizeFilePath } from './debug' ;
10
10
import { exec , spawn } from 'child_process' ;
11
11
import { default as psTree } from 'ps-tree' ;
@@ -85,15 +85,19 @@ export class Process implements AsyncDisposable {
85
85
86
86
private static async _getDockerChildPids (
87
87
containerName : string ,
88
- pid : number
88
+ pid : number ,
89
+ classConfig : ClassConfig
89
90
) : 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
+ ) ;
97
101
if ( ! result . stdout ) {
98
102
return [ ] ;
99
103
}
@@ -267,16 +271,17 @@ export class Process implements AsyncDisposable {
267
271
. dockerContainerName ;
268
272
const pids = [
269
273
pid ,
270
- ...( await Process . _getDockerChildPids ( containerName , pid ) ) ,
271
- ] ;
272
- return pids . map ( ( pid ) =>
273
- execute ( 'docker' , [
274
- 'exec' ,
274
+ ...( await Process . _getDockerChildPids (
275
275
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 )
280
285
) ;
281
286
}
282
287
0 commit comments