forked from lix-project/lix
Merge pull request #4233 from Kha/master
nix develop: Preserve stdin with `-c`
This commit is contained in:
commit
3f680c1dcc
|
@ -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();
|
||||
|
|
|
@ -59,6 +59,12 @@ output=$($TEST_ROOT/shell.shebang.rb abc ruby)
|
|||
# Test 'nix develop'.
|
||||
nix develop -f shell.nix shellDrv -c bash -c '[[ -n $stdenv ]]'
|
||||
|
||||
# Ensure `nix develop -c` preserves stdin
|
||||
echo foo | nix develop -f shell.nix shellDrv -c cat | grep -q foo
|
||||
|
||||
# Ensure `nix develop -c` actually executes the command if stdout isn't a terminal
|
||||
nix develop -f shell.nix shellDrv -c echo foo |& grep -q foo
|
||||
|
||||
# Test 'nix print-dev-env'.
|
||||
source <(nix print-dev-env -f shell.nix shellDrv)
|
||||
[[ -n $stdenv ]]
|
||||
|
|
Loading…
Reference in a new issue