Skip to content

Commit 2e26aa9

Browse files
committed
escape the commandline given to 633 E
Per the changes in microsoft#157571.
1 parent de2ae1d commit 2e26aa9

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/vs/workbench/contrib/terminal/browser/media/shellIntegration.fish

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,18 @@ end
3333
# Marks the beginning of command output.
3434
function __vsc_cmd_executed --on-event fish_preexec
3535
__vsc_esc C
36-
__vsc_esc E "$argv"
36+
__vsc_esc E (__vsc_escape_cmd "$argv")
37+
end
38+
39+
40+
# Escapes backslashes, newlines, and semicolons to serialize the command line.
41+
function __vsc_escape_cmd
42+
set -l commandline "$argv"
43+
# `string replace` automatically breaks its input apart on any newlines.
44+
# Then `string join` at the end will bring it all back together.
45+
string replace --all '\\' '\\\\' $commandline \
46+
| string replace --all ';' '\x3b' \
47+
| string join '\x0a'
3748
end
3849
3950
# Sent right after an interactive command has finished executing.

0 commit comments

Comments
 (0)