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:
Shea Levy 2016-09-08 09:10:50 -04:00
parent fb577a431f
commit 8bddc3d406
1 changed files with 0 additions and 2 deletions

View File

@ -288,7 +288,6 @@ foreach my $expr (@exprs) {
writeFile(
$rcfile,
"rm -rf '$tmpDir'; " .
'unset BASH_ENV; ' .
'[ -n "$PS1" ] && [ -e ~/.bashrc ] && source ~/.bashrc; ' .
($pure ? '' : 'p=$PATH; ' ) .
'dontAddDisableDepTrack=1; ' .
@ -302,7 +301,6 @@ foreach my $expr (@exprs) {
'shopt -u nullglob; ' .
'unset TZ; ' . (defined $ENV{'TZ'} ? "export TZ='${ENV{'TZ'}}'; " : '') .
$envCommand);
$ENV{BASH_ENV} = $rcfile;
my @args = ($ENV{NIX_BUILD_SHELL} // "bash");
push @args, "--rcfile" if $interactive;
push @args, $rcfile;