From 47a0a7c1277b608511a01cdfa39077dcdf8f8b7c Mon Sep 17 00:00:00 2001 From: Bill Ticehurst Date: Fri, 26 May 2017 13:56:57 -0700 Subject: [PATCH 1/2] Wrap npmLocation if needed --- src/server/typingsInstaller/nodeTypingsInstaller.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/server/typingsInstaller/nodeTypingsInstaller.ts b/src/server/typingsInstaller/nodeTypingsInstaller.ts index d3261a7ebdf..3ebdbd28de4 100644 --- a/src/server/typingsInstaller/nodeTypingsInstaller.ts +++ b/src/server/typingsInstaller/nodeTypingsInstaller.ts @@ -85,6 +85,11 @@ namespace ts.server.typingsInstaller { throttleLimit, log); this.npmPath = npmLocation !== undefined ? npmLocation : getDefaultNPMLocation(process.argv[0]); + + // If the NPM path contains spaces and isn't wrapped in quotes, do so. + if (this.npmPath.indexOf(" ") !== -1 && this.npmPath[0] != `"`) { + this.npmPath = `"${this.npmPath}"`; + } if (this.log.isEnabled()) { this.log.writeLine(`Process id: ${process.pid}`); this.log.writeLine(`NPM location: ${this.npmPath} (explicit '${Arguments.NpmLocation}' ${npmLocation === undefined ? "not " : ""} provided)`); @@ -183,4 +188,4 @@ namespace ts.server.typingsInstaller { }); const installer = new NodeTypingsInstaller(globalTypingsCacheLocation, typingSafeListLocation, npmLocation, /*throttleLimit*/5, log); installer.listen(); -} \ No newline at end of file +} From d7555eda3b3df03b6d44e9cffcdbbeb4a4c02712 Mon Sep 17 00:00:00 2001 From: Bill Ticehurst Date: Fri, 26 May 2017 14:02:18 -0700 Subject: [PATCH 2/2] Fix equals --- src/server/typingsInstaller/nodeTypingsInstaller.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/typingsInstaller/nodeTypingsInstaller.ts b/src/server/typingsInstaller/nodeTypingsInstaller.ts index 3ebdbd28de4..9eff5a6f104 100644 --- a/src/server/typingsInstaller/nodeTypingsInstaller.ts +++ b/src/server/typingsInstaller/nodeTypingsInstaller.ts @@ -87,7 +87,7 @@ namespace ts.server.typingsInstaller { this.npmPath = npmLocation !== undefined ? npmLocation : getDefaultNPMLocation(process.argv[0]); // If the NPM path contains spaces and isn't wrapped in quotes, do so. - if (this.npmPath.indexOf(" ") !== -1 && this.npmPath[0] != `"`) { + if (this.npmPath.indexOf(" ") !== -1 && this.npmPath[0] !== `"`) { this.npmPath = `"${this.npmPath}"`; } if (this.log.isEnabled()) {