julia icon indicating copy to clipboard operation
julia copied to clipboard

REPL shell mode is incompatible with nushell

Open MilesCranmer opened this issue 1 year ago • 4 comments

It seems that the nushell shell is incompatible with the Julia REPL at the moment. When I hit ; in the Julia REPL to open the shell, and write any command, I get this:

julia> ;
shell> echo "Hello World"
Error: nu::parser::shell_andand

  × The '&&' operator is not supported in Nushell
   ╭─[source:1:22]
 1 │ (echo 'Hello World') && true
   ·                      ─┬
   ·                       ╰── instead of '&&', use ';' or 'and'
   ╰────
  help: use ';' instead of the shell '&&', or 'and' instead of the boolean '&&'

I think the Julia REPL should either be made compatible with nushell, or it should run commands in a compatible shell like bash. Right now I can't seem to do anything in the shell mode because my default shell is nushell.

Context: Nushell is a new type of cross-platform shell written in pure rust: https://github.com/nushell/nushell/. Instead of "&&" they use "and" (among several other differences).

MilesCranmer avatar Apr 28 '24 15:04 MilesCranmer

I also would like to use nushell. This Discourse post says that shell mode only supports POSIX shells and that one can set the JULIA_SHELL environment variable as a workaround.

jakobjpeters avatar Apr 29 '24 05:04 jakobjpeters

The shell> mode in the REPL doesn't actually spawn a shell, and instead evokes programs directly IIRC. How does this end up calling into nushell in the first place?

Seelengrab avatar Apr 29 '24 08:04 Seelengrab

I’m not sure how it gets called. Maybe if JULIA_SHELL is unset it simply takes SHELL?

But where does the && come from? All that needs to be changed is that. Is that from run?

At the bottom of https://github.com/JuliaLang/julia/issues/23597 @xgdgsc and @stevengj were also discussing Nushell as a potential solution to having a shell mode on windows.

MilesCranmer avatar Apr 29 '24 09:04 MilesCranmer

The shell> mode in the REPL doesn't actually spawn a shell, and instead evokes programs directly IIRC

I think the shell mode does spawn a shell. Perhaps you are thinking about run?

Anyway, a small tweak to

https://github.com/JuliaLang/julia/blob/6023ad6718514c15b3297197757ae3d93b85270b/base/client.jl#L63-L68

could probably fix this.

KristofferC avatar Apr 29 '24 09:04 KristofferC