@@ -5,6 +5,8 @@ import * as path from 'path';
5
5
import { EXTENSION_ROOT_DIR } from '../constants' ;
6
6
import { PythonVersionInfo } from './types' ;
7
7
8
+ const ISOLATED = path . join ( SCRIPTS_DIR , 'pyvsc-run-isolated.py' ) ;
9
+
8
10
/****************************
9
11
* The following namespaces cover the following:
10
12
*
@@ -55,7 +57,7 @@ export namespace scripts {
55
57
56
58
export function interpreterInfo ( ) : [ string [ ] , ( out : string ) => PythonEnvInfo ] {
57
59
const script = path . join ( SCRIPTS_DIR , 'interpreterInfo.py' ) ;
58
- const args = [ script ] ;
60
+ const args = [ ISOLATED , script ] ;
59
61
60
62
function parse ( out : string ) : PythonEnvInfo {
61
63
let json : PythonEnvInfo ;
@@ -165,7 +167,7 @@ export namespace scripts {
165
167
166
168
export function completion ( jediPath ?: string ) : [ string [ ] , ( out : string ) => _completion . Response [ ] ] {
167
169
const script = path . join ( SCRIPTS_DIR , 'completion.py' ) ;
168
- const args = [ script ] ;
170
+ const args = [ ISOLATED , script ] ;
169
171
if ( jediPath ) {
170
172
args . push ( 'custom' ) ;
171
173
args . push ( jediPath ) ;
@@ -183,7 +185,7 @@ export namespace scripts {
183
185
184
186
export function sortImports ( filename : string , sortArgs ?: string [ ] ) : [ string [ ] , ( out : string ) => string ] {
185
187
const script = path . join ( SCRIPTS_DIR , 'sortImports.py' ) ;
186
- const args = [ script , filename , '--diff' ] ;
188
+ const args = [ ISOLATED , script , filename , '--diff' ] ;
187
189
if ( sortArgs ) {
188
190
args . push ( ...sortArgs ) ;
189
191
}
@@ -201,7 +203,7 @@ export namespace scripts {
201
203
202
204
export function refactor ( root : string ) : [ string [ ] , ( out : string ) => object [ ] ] {
203
205
const script = path . join ( SCRIPTS_DIR , 'refactor.py' ) ;
204
- const args = [ script , root ] ;
206
+ const args = [ ISOLATED , script , root ] ;
205
207
206
208
// tslint:disable-next-line:no-suspicious-comment
207
209
// TODO: Make the return type more specific, like we did
@@ -223,7 +225,7 @@ export namespace scripts {
223
225
224
226
export function normalizeForInterpreter ( code : string ) : [ string [ ] , ( out : string ) => string ] {
225
227
const script = path . join ( SCRIPTS_DIR , 'normalizeForInterpreter.py' ) ;
226
- const args = [ script , code ] ;
228
+ const args = [ ISOLATED , script , code ] ;
227
229
228
230
function parse ( out : string ) {
229
231
// The text will be used as-is.
@@ -262,7 +264,7 @@ export namespace scripts {
262
264
text ?: string
263
265
) : [ string [ ] , ( out : string ) => _symbolProvider . Symbols ] {
264
266
const script = path . join ( SCRIPTS_DIR , 'symbolProvider.py' ) ;
265
- const args = [ script , filename ] ;
267
+ const args = [ ISOLATED , script , filename ] ;
266
268
if ( text ) {
267
269
args . push ( text ) ;
268
270
}
@@ -279,7 +281,7 @@ export namespace scripts {
279
281
280
282
export function printEnvVariables ( ) : [ string [ ] , ( out : string ) => NodeJS . ProcessEnv ] {
281
283
const script = path . join ( SCRIPTS_DIR , 'printEnvVariables.py' ) . fileToCommandArgument ( ) ;
282
- const args = [ script ] ;
284
+ const args = [ ISOLATED , script ] ;
283
285
284
286
function parse ( out : string ) : NodeJS . ProcessEnv {
285
287
return JSON . parse ( out ) ;
@@ -293,7 +295,7 @@ export namespace scripts {
293
295
294
296
export function printEnvVariablesToFile ( filename : string ) : [ string [ ] , ( out : string ) => NodeJS . ProcessEnv ] {
295
297
const script = path . join ( SCRIPTS_DIR , 'printEnvVariablesToFile.py' ) ;
296
- const args = [ script , filename . fileToCommandArgument ( ) ] ;
298
+ const args = [ ISOLATED , script , filename . fileToCommandArgument ( ) ] ;
297
299
298
300
function parse ( out : string ) : NodeJS . ProcessEnv {
299
301
return JSON . parse ( out ) ;
@@ -310,6 +312,7 @@ export namespace scripts {
310
312
// We don't bother with a "parse" function since the output
311
313
// could be anything.
312
314
return [
315
+ ISOLATED ,
313
316
script ,
314
317
command . fileToCommandArgument ( ) ,
315
318
// The shell args must come after the command
@@ -325,7 +328,7 @@ export namespace scripts {
325
328
export function testlauncher ( testArgs : string [ ] ) : string [ ] {
326
329
const script = path . join ( SCRIPTS_DIR , 'testlauncher.py' ) ;
327
330
// There is no output to parse, so we do not return a function.
328
- return [ script , ...testArgs ] ;
331
+ return [ ISOLATED , script , ...testArgs ] ;
329
332
}
330
333
331
334
//============================
@@ -334,7 +337,7 @@ export namespace scripts {
334
337
export function visualstudio_py_testlauncher ( testArgs : string [ ] ) : string [ ] {
335
338
const script = path . join ( SCRIPTS_DIR , 'visualstudio_py_testlauncher.py' ) ;
336
339
// There is no output to parse, so we do not return a function.
337
- return [ script , ...testArgs ] ;
340
+ return [ ISOLATED , script , ...testArgs ] ;
338
341
}
339
342
340
343
//============================
@@ -384,6 +387,9 @@ export namespace scripts {
384
387
385
388
export function run_adapter ( adapterArgs : string [ ] ) : [ string [ ] , ( out : string ) => DiscoveredTests [ ] ] {
386
389
const script = path . join ( _SCRIPTS_DIR , 'run_adapter.py' ) ;
390
+ // Note that we for now we do not run this "isolated". The
391
+ // script relies on some magic that conflicts with the
392
+ // isolated script.
387
393
const args = [ script , ...adapterArgs ] ;
388
394
389
395
function parse ( out : string ) : DiscoveredTests [ ] {
@@ -418,7 +424,7 @@ export namespace scripts {
418
424
export function getJupyterVariableDataFrameInfo ( ) : string [ ] {
419
425
const script = path . join ( _SCRIPTS_DIR , 'getJupyterVariableDataFrameInfo.py' ) ;
420
426
// There is no script-specific output to parse, so we do not return a function.
421
- return [ script ] ;
427
+ return [ ISOLATED , script ] ;
422
428
}
423
429
424
430
//============================
@@ -427,15 +433,15 @@ export namespace scripts {
427
433
export function getJupyterVariableDataFrameRows ( ) : string [ ] {
428
434
const script = path . join ( _SCRIPTS_DIR , 'getJupyterVariableDataFrameRows.py' ) ;
429
435
// There is no script-specific output to parse, so we do not return a function.
430
- return [ script ] ;
436
+ return [ ISOLATED , script ] ;
431
437
}
432
438
433
439
//============================
434
440
// getServerInfo.py
435
441
436
442
export function getServerInfo ( ) : [ string [ ] , ( out : string ) => JupyterServerInfo [ ] ] {
437
443
const script = path . join ( _SCRIPTS_DIR , 'getServerInfo.py' ) ;
438
- const args = [ script ] ;
444
+ const args = [ ISOLATED , script ] ;
439
445
440
446
function parse ( out : string ) : JupyterServerInfo [ ] {
441
447
return JSON . parse ( out . trim ( ) ) ;
@@ -450,7 +456,7 @@ export namespace scripts {
450
456
export function getJupyterKernels ( ) : string [ ] {
451
457
const script = path . join ( _SCRIPTS_DIR , 'getJupyterKernels.py' ) ;
452
458
// There is no script-specific output to parse, so we do not return a function.
453
- return [ script ] ;
459
+ return [ ISOLATED , script ] ;
454
460
}
455
461
456
462
//============================
@@ -459,15 +465,15 @@ export namespace scripts {
459
465
export function getJupyterKernelspecVersion ( ) : string [ ] {
460
466
const script = path . join ( _SCRIPTS_DIR , 'getJupyterKernelspecVersion.py' ) ;
461
467
// For now we do not worry about parsing the output here.
462
- return [ script ] ;
468
+ return [ ISOLATED , script ] ;
463
469
}
464
470
465
471
//============================
466
472
// jupyter_nbInstalled.py
467
473
468
474
export function jupyter_nbInstalled ( ) : [ string [ ] , ( out : string ) => boolean ] {
469
475
const script = path . join ( _SCRIPTS_DIR , 'jupyter_nbInstalled.py' ) ;
470
- const args = [ script ] ;
476
+ const args = [ ISOLATED , script ] ;
471
477
472
478
function parse ( out : string ) : boolean {
473
479
return out . toLowerCase ( ) . includes ( 'available' ) ;
0 commit comments