Skip to content

Using the SHELL env variable is a breaking change #1260

@julienfouilhe

Description

@julienfouilhe

The patch version 8.6.1 introduces using the SHELL variable if defined.

Except that I use fish, and it defines the SHELL variable to use fish. Now all my scripts are broken because of the following error after running a command (here which sentry-cli)

$ which sentry-cli
set: -euo: unknown option

Standard input (line 1): 
set -euo pipefail;which sentry-cli
^

(Type 'help set' for related documentation)
  • This change should have been in my opinion at least a minor. It breaks the behavior that zx uses bash to now use the user's SHELL.
  • Since using the SHELL environment variable can change the way commands should be run, if a SHELL env variable is used, shouldn't it reset the $.prefix?
  • The docs still state that the default for the $.shell variable is which bash, which isn't true if it uses a SHELL env variable.
  • There should be an easy way for reverting to the old behavior from a script. I can't use $.shell = which bash; since using $`` fails everytime, and I can't hardcode the path to bash since I don't know where it's installed on everyone running my script's machine? Edit: Found out about useBash(), I guess I can add this to all my scripts!

Are you sure this change is valid though? Seems strange to me that by default, zx would run using the user's shell.
zx scripts should be reproducible and therefore use the same shell always, shouldn't they?

cc @antongolub

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions