Skip to content

Commit 4a18c88

Browse files
committed
Fix space escaping bug in existing-terminal
When used while HTTP Toolkit was running in a path containing a space, the quotes in NODE_OPTIONS weren't escaped in the shell script that included it. That made the shell script invalid, breaking it entirely. We now ensure that all env var values have any quotes included correctly escaped.
1 parent 94a2451 commit 4a18c88

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/interceptors/terminal/terminal-scripts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ ${END_CONFIG_SECTION}`;
7171

7272
// A source-able shell script. Should work for everything except fish, sadly.
7373
export const getShellScript = (env: { [name: string]: string }) => `${
74-
_.map(env, (value, key) => ` export ${key}="${value}"`).join('\n')
74+
_.map(env, (value, key) => ` export ${key}="${value.replace(/"/g, '\\"')}"`).join('\n')
7575
}
7676
7777
if command -v winpty >/dev/null 2>&1; then

0 commit comments

Comments
 (0)