Fix early removal of rc-file for nix-shell
BASH_ENV causes all non-interactive shells called via eg. /etc/bashrc to remove the rc-file before the main shell gets to run it. Completion scripts will often do this. Fixes #976. Adapted from and fixes #1034.
This commit is contained in:
parent
fb577a431f
commit
8bddc3d406
|
@ -288,7 +288,6 @@ foreach my $expr (@exprs) {
|
||||||
writeFile(
|
writeFile(
|
||||||
$rcfile,
|
$rcfile,
|
||||||
"rm -rf '$tmpDir'; " .
|
"rm -rf '$tmpDir'; " .
|
||||||
'unset BASH_ENV; ' .
|
|
||||||
'[ -n "$PS1" ] && [ -e ~/.bashrc ] && source ~/.bashrc; ' .
|
'[ -n "$PS1" ] && [ -e ~/.bashrc ] && source ~/.bashrc; ' .
|
||||||
($pure ? '' : 'p=$PATH; ' ) .
|
($pure ? '' : 'p=$PATH; ' ) .
|
||||||
'dontAddDisableDepTrack=1; ' .
|
'dontAddDisableDepTrack=1; ' .
|
||||||
|
@ -302,7 +301,6 @@ foreach my $expr (@exprs) {
|
||||||
'shopt -u nullglob; ' .
|
'shopt -u nullglob; ' .
|
||||||
'unset TZ; ' . (defined $ENV{'TZ'} ? "export TZ='${ENV{'TZ'}}'; " : '') .
|
'unset TZ; ' . (defined $ENV{'TZ'} ? "export TZ='${ENV{'TZ'}}'; " : '') .
|
||||||
$envCommand);
|
$envCommand);
|
||||||
$ENV{BASH_ENV} = $rcfile;
|
|
||||||
my @args = ($ENV{NIX_BUILD_SHELL} // "bash");
|
my @args = ($ENV{NIX_BUILD_SHELL} // "bash");
|
||||||
push @args, "--rcfile" if $interactive;
|
push @args, "--rcfile" if $interactive;
|
||||||
push @args, $rcfile;
|
push @args, $rcfile;
|
||||||
|
|
Loading…
Reference in a new issue