Make bash non-interactive for nix develop --phase

Fix #3975: Currently if Ctrl-C is pressed during a phase, the interactive subshell
is not exited. Removing --rcfile when --phase is present makes bash
non-interactive
This commit is contained in:
Matthew Kenigsberg 2020-10-20 11:48:07 -05:00
parent e0ca98c207
commit f6aaac2b59

View file

@ -368,7 +368,6 @@ struct CmdDevelop : Common, MixEnvironment
// rid of that. // rid of that.
script += fmt("foundMakefile=1\n"); script += fmt("foundMakefile=1\n");
script += fmt("runHook %1%Phase\n", *phase); script += fmt("runHook %1%Phase\n", *phase);
script += fmt("exit 0\n", *phase);
} }
else if (!command.empty()) { else if (!command.empty()) {
@ -408,7 +407,10 @@ struct CmdDevelop : Common, MixEnvironment
ignoreException(); ignoreException();
} }
auto args = Strings{std::string(baseNameOf(shell)), "--rcfile", rcFilePath}; // If running a phase, don't want an interactive shell running after
// Ctrl-C, so don't pass --rcfile
auto args = phase ? Strings{std::string(baseNameOf(shell)), rcFilePath}
: Strings{std::string(baseNameOf(shell)), "--rcfile", rcFilePath};
restoreAffinity(); restoreAffinity();
restoreSignals(); restoreSignals();