Skip to content

Commit 49536ec

Browse files
committed
Handle white space
1 parent e60ed9a commit 49536ec

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/features/terminal/runInTerminal.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,17 @@ export async function runInTerminal(
2828
deferred.resolve();
2929
}
3030
});
31+
32+
const shouldSurroundWithQuotes =
33+
executable.includes(' ') && !executable.startsWith('"') && !executable.endsWith('"');
34+
// Handle case where executable contains white-spaces.
35+
if (shouldSurroundWithQuotes) {
36+
executable = `"${executable}"`;
37+
}
38+
3139
if (shellType === ShellConstants.PWSH && !executable.startsWith('&')) {
3240
// PowerShell requires commands to be prefixed with '&' to run them.
33-
executable = `& "${executable}"`;
41+
executable = `& ${executable}`;
3442
}
3543
execution = terminal.shellIntegration.executeCommand(executable, allArgs);
3644
await deferred.promise;

0 commit comments

Comments
 (0)