Skip to content

Commit 05d3ff1

Browse files
committed
Wrap npmLocation if needed
1 parent f938caf commit 05d3ff1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/server/typingsInstaller/nodeTypingsInstaller.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ namespace ts.server.typingsInstaller {
8585
throttleLimit,
8686
log);
8787
this.npmPath = npmLocation !== undefined ? npmLocation : getDefaultNPMLocation(process.argv[0]);
88+
89+
// If the NPM path contains spaces and isn't wrapped in quotes, do so.
90+
if (this.npmPath.indexOf(" ") !== -1 && this.npmPath[0] != `"`) {
91+
this.npmPath = `"${this.npmPath}"`;
92+
}
8893
if (this.log.isEnabled()) {
8994
this.log.writeLine(`Process id: ${process.pid}`);
9095
this.log.writeLine(`NPM location: ${this.npmPath} (explicit '${Arguments.NpmLocation}' ${npmLocation === undefined ? "not " : ""} provided)`);
@@ -186,4 +191,4 @@ namespace ts.server.typingsInstaller {
186191
});
187192
const installer = new NodeTypingsInstaller(globalTypingsCacheLocation, typingSafeListLocation, npmLocation, /*throttleLimit*/5, log);
188193
installer.listen();
189-
}
194+
}

0 commit comments

Comments
 (0)