From 65ee7aa372ad868ac1ce982e2ff798f9528d7228 Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Tue, 25 May 2021 09:19:45 -0500 Subject: [PATCH] correctly escape pipe in windows/cmd.exe (#3489) * correctly escape pipe in windows/cmd.exe * add some comments, take out debug line --- crates/nu-command/src/commands/classified/external.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/nu-command/src/commands/classified/external.rs b/crates/nu-command/src/commands/classified/external.rs index 79a7b43401..c05c0a1591 100644 --- a/crates/nu-command/src/commands/classified/external.rs +++ b/crates/nu-command/src/commands/classified/external.rs @@ -150,7 +150,9 @@ fn spawn( process.arg(&command.name); for arg in args { // Clean the args before we use them: - let arg = arg.replace("|", "\\|"); + // https://stackoverflow.com/questions/1200235/how-to-pass-a-quoted-pipe-character-to-cmd-exe + // cmd.exe needs to have a caret to escape a pipe + let arg = arg.replace("|", "^|"); process.arg(&arg); } process