-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
nix develop: Preserve stdin with -c
#4233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice :)
Left a couple of comments, but looks good otherwise
src/nix/develop.cc
Outdated
@@ -437,7 +437,7 @@ struct CmdDevelop : Common, MixEnvironment | |||
std::vector<std::string> args; | |||
for (auto s : command) | |||
args.push_back(shellEscape(s)); | |||
script += fmt("exec %s\n", concatStringsSep(" ", args)); | |||
script += concatStringsSep(" ", args); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exec
isn't needed anymore, so I thought I may as well simplify the code (since it's not being used for --phase
either). Before, it was necessary for exiting the then-interactive shell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a strong opinion on this, but it seems cleaner to keep it, if only to avoid having a useless bash process lying around while the command is running
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, why not. Reverted.
Co-authored-by: Théophane Hufschmitt <regnat@users.noreply.github.com>
For use in editor integration, I would like to run a derivation taking input from stdin instead of $src, basically
However, this currently breaks because of
nix develop
's use of--rcfile
: the stdin is executed by the shell instead of being passed to the-c
command. Not using--rcfile
with-c
, just like it's already being done with--phase
, fixes this.