From 1ed87223beaa109660fc78e3d7fc300207c9d10a Mon Sep 17 00:00:00 2001 From: sandyspiers Date: Wed, 14 May 2025 12:12:55 +0800 Subject: [PATCH 1/3] add support for nushell --- base/client.jl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/base/client.jl b/base/client.jl index 5bf658bead437..2279bd69b2067 100644 --- a/base/client.jl +++ b/base/client.jl @@ -64,7 +64,13 @@ function repl_cmd(cmd, out) cd(dir) println(out, pwd()) else - @static if !Sys.iswindows() + iswindows = @static Sys.iswindows() ? true : false + if shell_name == "nu" + # remove backticks and apostrophes that dont play nice with nushell + shell_escape_cmd = replace(shell_escape(cmd), r"`|'" => "") + shell_escape_cmd = "try { $shell_escape_cmd } catch { |err| \$err.rendered }" + cmd = `$shell -c $shell_escape_cmd` + elseif !iswindows if shell_name == "fish" shell_escape_cmd = "begin; $(shell_escape_posixly(cmd)); and true; end" else From df360887cff0e2a7475faadd6b0f2bdf944eb9ca Mon Sep 17 00:00:00 2001 From: Sandy Spiers <86579677+sandyspiers@users.noreply.github.com> Date: Wed, 14 May 2025 20:38:00 +0800 Subject: [PATCH 2/3] remove regex and @static macro Replace regex with explicit replace. Remove @static macro and use `Sys.iswindows()` instead Co-authored-by: Jakob Nybo Nissen --- base/client.jl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/base/client.jl b/base/client.jl index 2279bd69b2067..6409d06359c6d 100644 --- a/base/client.jl +++ b/base/client.jl @@ -64,13 +64,12 @@ function repl_cmd(cmd, out) cd(dir) println(out, pwd()) else - iswindows = @static Sys.iswindows() ? true : false if shell_name == "nu" # remove backticks and apostrophes that dont play nice with nushell - shell_escape_cmd = replace(shell_escape(cmd), r"`|'" => "") + shell_escape_cmd = replace(shell_escape(cmd), "'" => "", "`" => "") shell_escape_cmd = "try { $shell_escape_cmd } catch { |err| \$err.rendered }" cmd = `$shell -c $shell_escape_cmd` - elseif !iswindows + elseif !Sys.iswindows() if shell_name == "fish" shell_escape_cmd = "begin; $(shell_escape_posixly(cmd)); and true; end" else From 39ffeeb763fd07bb61541d460b93f3bb0374a46f Mon Sep 17 00:00:00 2001 From: sandyspiers Date: Fri, 16 May 2025 09:53:15 +0800 Subject: [PATCH 3/3] no need to remove backticks --- base/client.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base/client.jl b/base/client.jl index 6409d06359c6d..7bcab0c4c0d82 100644 --- a/base/client.jl +++ b/base/client.jl @@ -65,8 +65,8 @@ function repl_cmd(cmd, out) println(out, pwd()) else if shell_name == "nu" - # remove backticks and apostrophes that dont play nice with nushell - shell_escape_cmd = replace(shell_escape(cmd), "'" => "", "`" => "") + # remove apostrophes that dont play nice with nushell + shell_escape_cmd = replace(shell_escape(cmd), "'" => "") shell_escape_cmd = "try { $shell_escape_cmd } catch { |err| \$err.rendered }" cmd = `$shell -c $shell_escape_cmd` elseif !Sys.iswindows()