From 23725abd4249811f24475e215c2d78ed5e508e79 Mon Sep 17 00:00:00 2001 From: Ian Huff Date: Fri, 4 Sep 2020 11:20:40 -0700 Subject: [PATCH] IPyKernel install issue with windows paths (#13667) * Both changes * remove args change * Remove logging message * Add news * remove logMessage imports * Update python.ts * Fix unit tests * Actually fix the unit tests Co-authored-by: Rich Chiodo --- news/2 Fixes/13493.md | 1 + src/client/common/process/internal/python.ts | 2 +- src/client/common/process/internal/scripts/index.ts | 2 +- src/test/common/moduleInstaller.test.ts | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 news/2 Fixes/13493.md diff --git a/news/2 Fixes/13493.md b/news/2 Fixes/13493.md new file mode 100644 index 000000000000..c7c567cfed4a --- /dev/null +++ b/news/2 Fixes/13493.md @@ -0,0 +1 @@ +Fix path to isolated script on Windows shell_exec. diff --git a/src/client/common/process/internal/python.ts b/src/client/common/process/internal/python.ts index 86123367f852..d553e54293c1 100644 --- a/src/client/common/process/internal/python.ts +++ b/src/client/common/process/internal/python.ts @@ -28,7 +28,7 @@ export function execCode(code: string, isolated = true): string[] { export function execModule(name: string, moduleArgs: string[], isolated = true): string[] { const args = ['-m', name, ...moduleArgs]; if (isolated) { - args[0] = ISOLATED; // replace + args[0] = ISOLATED.fileToCommandArgument(); } // "code" isn't specific enough to know how to parse it, // so we only return the args. diff --git a/src/client/common/process/internal/scripts/index.ts b/src/client/common/process/internal/scripts/index.ts index ec59c6f6a483..74408e81e1e6 100644 --- a/src/client/common/process/internal/scripts/index.ts +++ b/src/client/common/process/internal/scripts/index.ts @@ -306,7 +306,7 @@ export function shell_exec(command: string, lockfile: string, shellArgs: string[ // We don't bother with a "parse" function since the output // could be anything. return [ - ISOLATED, + ISOLATED.fileToCommandArgument(), script, command.fileToCommandArgument(), // The shell args must come after the command diff --git a/src/test/common/moduleInstaller.test.ts b/src/test/common/moduleInstaller.test.ts index abae5cd316a5..a5bccb537869 100644 --- a/src/test/common/moduleInstaller.test.ts +++ b/src/test/common/moduleInstaller.test.ts @@ -140,7 +140,7 @@ import { closeActiveWindows, initializeTest } from './../initialize'; chai_use(chaiAsPromised); -const isolated = path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'pythonFiles', 'pyvsc-run-isolated.py'); +const isolated = path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'pythonFiles', 'pyvsc-run-isolated.py').replace(/\\/g, '/'); const info: PythonEnvironment = { architecture: Architecture.Unknown,