Support for non-POSIX shells

The Julia’s shell mode does not seem to work properly when a non-POSIX shell is set as the default system shell. I’m using Nushell, however, I imagine a similar issue is also present with other popular non-POSIX shells, such as fish, ion or elvish.

(I’m asking with a Linux environment in mind. I haven’t tried the Windows + PowerShell combo.)

Basically, the issue I have is that I cannot run common tasks in Julia’s shell since it apparently expects some degree of compliance with POSIX shells, such as Bash:

julia> ;
shell> ls
error: Coercion error
  ┌─ shell:1:1
  │
1 │ (ls) && true
  │ ^^^^    ---- string
  │ │
  │ table

The strange-looking error comes from Nushell: The && is a boolean operator and the error tells you that you cannot perform boolean “AND” on a table (output of ls) and a string.

My questions are:

  1. How is the shell handled in Julia?
  2. Is is possible to add support for non-POSIX shells to Julia?
  3. How hard would it be?

I am very new to Julia, but I am likely going to use it a lot in the near future and I would be willing to contribute in this area, if it is within some reasonable complexity.

To me, it seems like removing the () and && wrapping should solve the issue. This could be configurable so that POSIX users will still have the same experience.

A temporary workaround is to set the JULIA_SHELL to, e.g., Bash before running julia, but of course, ideally, you want to use your favourite shell.

1 Like

The shell mode in windows+powershell also has problems
https://github.com/JuliaLang/julia/issues/23597