@@ -8,6 +8,8 @@ import { PythonVersionInfo } from '../../types';
8
8
// It is simpler to hard-code it instead of using vscode.ExtensionContext.extensionPath.
9
9
export const _SCRIPTS_DIR = path . join ( EXTENSION_ROOT_DIR , 'pythonFiles' ) ;
10
10
const SCRIPTS_DIR = _SCRIPTS_DIR ;
11
+ export const _ISOLATED = path . join ( _SCRIPTS_DIR , 'pyvsc-run-isolated.py' ) ;
12
+ const ISOLATED = _ISOLATED ;
11
13
12
14
// "scripts" contains everything relevant to the scripts found under
13
15
// the top-level "pythonFiles" directory. Each of those scripts has
@@ -48,7 +50,7 @@ type PythonEnvInfo = {
48
50
49
51
export function interpreterInfo ( ) : [ string [ ] , ( out : string ) => PythonEnvInfo ] {
50
52
const script = path . join ( SCRIPTS_DIR , 'interpreterInfo.py' ) ;
51
- const args = [ script ] ;
53
+ const args = [ ISOLATED , script ] ;
52
54
53
55
function parse ( out : string ) : PythonEnvInfo {
54
56
let json : PythonEnvInfo ;
@@ -158,7 +160,7 @@ namespace _completion {
158
160
159
161
export function completion ( jediPath ?: string ) : [ string [ ] , ( out : string ) => _completion . Response [ ] ] {
160
162
const script = path . join ( SCRIPTS_DIR , 'completion.py' ) ;
161
- const args = [ script ] ;
163
+ const args = [ ISOLATED , script ] ;
162
164
if ( jediPath ) {
163
165
args . push ( 'custom' ) ;
164
166
args . push ( jediPath ) ;
@@ -176,7 +178,7 @@ export function completion(jediPath?: string): [string[], (out: string) => _comp
176
178
177
179
export function sortImports ( filename : string , sortArgs ?: string [ ] ) : [ string [ ] , ( out : string ) => string ] {
178
180
const script = path . join ( SCRIPTS_DIR , 'sortImports.py' ) ;
179
- const args = [ script , filename , '--diff' ] ;
181
+ const args = [ ISOLATED , script , filename , '--diff' ] ;
180
182
if ( sortArgs ) {
181
183
args . push ( ...sortArgs ) ;
182
184
}
@@ -194,7 +196,7 @@ export function sortImports(filename: string, sortArgs?: string[]): [string[], (
194
196
195
197
export function refactor ( root : string ) : [ string [ ] , ( out : string ) => object [ ] ] {
196
198
const script = path . join ( SCRIPTS_DIR , 'refactor.py' ) ;
197
- const args = [ script , root ] ;
199
+ const args = [ ISOLATED , script , root ] ;
198
200
199
201
// tslint:disable-next-line:no-suspicious-comment
200
202
// TODO: Make the return type more specific, like we did
@@ -216,7 +218,7 @@ export function refactor(root: string): [string[], (out: string) => object[]] {
216
218
217
219
export function normalizeForInterpreter ( code : string ) : [ string [ ] , ( out : string ) => string ] {
218
220
const script = path . join ( SCRIPTS_DIR , 'normalizeForInterpreter.py' ) ;
219
- const args = [ script , code ] ;
221
+ const args = [ ISOLATED , script , code ] ;
220
222
221
223
function parse ( out : string ) {
222
224
// The text will be used as-is.
@@ -256,7 +258,7 @@ export function symbolProvider(
256
258
text ?: string
257
259
) : [ string [ ] , ( out : string ) => _symbolProvider . Symbols ] {
258
260
const script = path . join ( SCRIPTS_DIR , 'symbolProvider.py' ) ;
259
- const args = [ script , filename ] ;
261
+ const args = [ ISOLATED , script , filename ] ;
260
262
if ( text ) {
261
263
args . push ( text ) ;
262
264
}
@@ -273,7 +275,7 @@ export function symbolProvider(
273
275
274
276
export function printEnvVariables ( ) : [ string [ ] , ( out : string ) => NodeJS . ProcessEnv ] {
275
277
const script = path . join ( SCRIPTS_DIR , 'printEnvVariables.py' ) . fileToCommandArgument ( ) ;
276
- const args = [ script ] ;
278
+ const args = [ ISOLATED , script ] ;
277
279
278
280
function parse ( out : string ) : NodeJS . ProcessEnv {
279
281
return JSON . parse ( out ) ;
@@ -287,7 +289,7 @@ export function printEnvVariables(): [string[], (out: string) => NodeJS.ProcessE
287
289
288
290
export function printEnvVariablesToFile ( filename : string ) : [ string [ ] , ( out : string ) => NodeJS . ProcessEnv ] {
289
291
const script = path . join ( SCRIPTS_DIR , 'printEnvVariablesToFile.py' ) ;
290
- const args = [ script , filename . fileToCommandArgument ( ) ] ;
292
+ const args = [ ISOLATED , script , filename . fileToCommandArgument ( ) ] ;
291
293
292
294
function parse ( out : string ) : NodeJS . ProcessEnv {
293
295
return JSON . parse ( out ) ;
@@ -304,6 +306,7 @@ export function shell_exec(command: string, lockfile: string, shellArgs: string[
304
306
// We don't bother with a "parse" function since the output
305
307
// could be anything.
306
308
return [
309
+ ISOLATED ,
307
310
script ,
308
311
command . fileToCommandArgument ( ) ,
309
312
// The shell args must come after the command
@@ -319,7 +322,7 @@ export function shell_exec(command: string, lockfile: string, shellArgs: string[
319
322
export function testlauncher ( testArgs : string [ ] ) : string [ ] {
320
323
const script = path . join ( SCRIPTS_DIR , 'testlauncher.py' ) ;
321
324
// There is no output to parse, so we do not return a function.
322
- return [ script , ...testArgs ] ;
325
+ return [ ISOLATED , script , ...testArgs ] ;
323
326
}
324
327
325
328
//============================
@@ -328,5 +331,5 @@ export function testlauncher(testArgs: string[]): string[] {
328
331
export function visualstudio_py_testlauncher ( testArgs : string [ ] ) : string [ ] {
329
332
const script = path . join ( SCRIPTS_DIR , 'visualstudio_py_testlauncher.py' ) ;
330
333
// There is no output to parse, so we do not return a function.
331
- return [ script , ...testArgs ] ;
334
+ return [ ISOLATED , script , ...testArgs ] ;
332
335
}
0 commit comments