aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nix/develop.cc4
-rw-r--r--tests/nix-shell.sh1
2 files changed, 3 insertions, 2 deletions
diff --git a/src/nix/develop.cc b/src/nix/develop.cc
index 8fea7ee9c..457d94382 100644
--- a/src/nix/develop.cc
+++ b/src/nix/develop.cc
@@ -474,9 +474,9 @@ struct CmdDevelop : Common, MixEnvironment
ignoreException();
}
- // If running a phase, don't want an interactive shell running after
+ // If running a phase or single command, don't want an interactive shell running after
// Ctrl-C, so don't pass --rcfile
- auto args = phase ? Strings{std::string(baseNameOf(shell)), rcFilePath}
+ auto args = phase || !command.empty() ? Strings{std::string(baseNameOf(shell)), rcFilePath}
: Strings{std::string(baseNameOf(shell)), "--rcfile", rcFilePath};
restoreAffinity();
diff --git a/tests/nix-shell.sh b/tests/nix-shell.sh
index 1228bb04f..dfe8ed0c1 100644
--- a/tests/nix-shell.sh
+++ b/tests/nix-shell.sh
@@ -58,6 +58,7 @@ output=$($TEST_ROOT/shell.shebang.rb abc ruby)
# Test 'nix develop'.
nix develop -f shell.nix shellDrv -c bash -c '[[ -n $stdenv ]]'
+echo foo | nix develop -f shell.nix shellDrv -c cat # preserve stdin with `-c`
# Test 'nix print-dev-env'.
source <(nix print-dev-env -f shell.nix shellDrv)