Skip to content

Commit 1fa79ba

Browse files
committed
handle escaping of slash and quote
1 parent 2f5ebdf commit 1fa79ba

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/integrations/terminal/__tests__/streamUtils/pwshStream.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ export function createPowerShellStream(command: string): CommandStream {
2323
} else {
2424
// On Windows/macOS, use double quotes and escape inner double quotes
2525
// This is the original approach that works on Windows
26-
shellCommand = `pwsh -NoProfile -NonInteractive -Command "${command.replace(/"/g, '\\"')}"`
26+
const escapedCommand = command.replace(/\\/g, "\\\\").replace(/"/g, '\\"')
27+
shellCommand = `pwsh -NoProfile -NonInteractive -Command "${escapedCommand}"`
2728
}
2829

2930
console.log(`Executing PowerShell command on ${process.platform}: ${shellCommand}`)

0 commit comments

Comments
 (0)