aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Kenigsberg <matthewkenigsberg@gmail.com>2020-10-20 11:48:07 -0500
committerMatthew Kenigsberg <matthewkenigsberg@gmail.com>2020-10-20 12:00:30 -0500
commitf6aaac2b5983bd87cd6e2f648c9dd835c6d9373c (patch)
tree4708237b7a6b38c0df92a08f7fd4885462856ab8
parente0ca98c2071b815578470e280df8fdb750c7e23b (diff)
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
-rw-r--r--src/nix/develop.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nix/develop.cc b/src/nix/develop.cc
index 9372f43de..380417c82 100644
--- a/src/nix/develop.cc
+++ b/src/nix/develop.cc
@@ -368,7 +368,6 @@ struct CmdDevelop : Common, MixEnvironment
// rid of that.
script += fmt("foundMakefile=1\n");
script += fmt("runHook %1%Phase\n", *phase);
- script += fmt("exit 0\n", *phase);
}
else if (!command.empty()) {
@@ -408,7 +407,10 @@ struct CmdDevelop : Common, MixEnvironment
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();
restoreSignals();