xzfc / cached-nix-shell

Instant startup time for nix-shell
https://xzfc.github.io/cached-nix-shell/cached-nix-shell.1
The Unlicense
195 stars 16 forks source link

Different behaviour from nix-shell wrt `pipefail` #28

Closed mmilata closed 1 year ago

mmilata commented 1 year ago

nix-shell seems to have pipefail set (set -o pipefail) while cached-nix-shell does not:

$ nix-shell -p moreutils --run "false" ; echo $?
1
$ nix-shell -p moreutils --run "false | ts -s" ; echo $?
1
$ cached-nix-shell -p moreutils --run "false" ; echo $?
1
$ cached-nix-shell -p moreutils --run "false | ts -s" ; echo $?
0
xzfc commented 1 year ago

Added preserving of some shellopts/bashopts that are touched by stdenv/original nix-shell. I think these should be enough since nix expressions generally don't change it beyond what stdenv/setup.sh does, but if anything, we could add code to handle every possible option.