Repository navigation
Conversation
The reason being that it's not just command substitutions - it's also e.g. the prompt functions or completions. That means after this, |
Do you mean that you leave behind a cat waiting on stdin ? Could this |
Not quite. The cat has received a signal (SIGTTIN or SIGTTOU) because it tried to read from or write to a terminal that it did not have control over. Now, a process could react to these signals and do something different, but the default action is to stop (as if it received SIGSTOP), which is also what
No, because we never give it control of the terminal. We could theoretically give it up later, but that would make |
layus
left a comment
There was a problem hiding this comment.
I took time to test your patch, and this works amazingly well. Please merge as soon as possible :-).
It misunderstood your comment (which would print a newline and leave a stopped cat) as the new behavior, while it describes the old, buggy behavior.
I tested it and it gives
gmaudoux@klatch ~/p/fish> echo (cat)
Hello, World![^D, not rendered]
Hello, World!
gmaudoux@klatch ~/p/fish>
Simply amazing how this simple fix solves a longstanding pain.
|
May I however add that it does not solve the issue with pipes, for example with |
No, that's #206. Edit: Note that this exposes the actual issue there - we don't redirect properly, the command ends up connected to the terminal. With this, it'll have permission to read/write. Without this, it'd get SIGTTIN/SIGTTOU, be stopped and hang around. |
FYI, yes it does although that isn't immediately obvious since you are returned to your interactive shell. And you have to run the This simple fix seems almost too good to be correct. So it is going to need some testing and analysis before being merged. Having said that I am cautiously optimistic this is correct or at least more correct than the existing behavior based on my limited testing. |
Yes, it does. Though it also makes a certain degree of sense - this code explicitly stops any "subshell" from using the terminal, so removing it should allow it to.
Yes, "more correct" being the thing to shoot for. Maybe there is a case where something shouldn't receive access to the terminal, but that case should be handled specially then. Also it appears less common than command substitutions, given that I haven't found it so far. |
|
I can't think of how this change could cause problems absent bugs elsewhere in the code and I haven't observed any problems. Too, it is important to get more people testing this sooner rather than later. So I've gone ahead and merged it. |
|
I just want to say THANK YOU for fixing this. This was one of my biggest complaints about fish. I think now I might be sold for life. |
|
Man, four hours of troubleshooting trying to figure out what was causing my issue, looks like this was it! Thank you for the fix! |
The previous command ended up running all of the lines together on a single line and since the first line begins with a comment character, the entire script was effectively commented out! For additional information, see: * fish-shell/fish-shell#159 * fish-shell/fish-shell#3993 Additionally, commands run in a fish command substitution do not have access to the TTY, preventing vaulted from prompting for a password. Using piping avoids this issue all together. For additional information, see: * fish-shell/fish-shell#1362 * fish-shell/fish-shell#3922
The previous command ended up running all of the lines together on a single line and since the first line begins with a comment character, the entire script was effectively commented out! For additional information, see: * fish-shell/fish-shell#159 * fish-shell/fish-shell#3993 Additionally, commands run in a fish command substitution do not have access to the TTY, preventing vaulted from prompting for a password. Using piping avoids this issue all together. For additional information, see: * fish-shell/fish-shell#1362 * fish-shell/fish-shell#3922
Description
It turns out the reason
fzfet al don't work in command substitutions (for some reason known as "subshells" in this part of the code) is that we don't give them the JOB_TERMINAL flag, which means we don't hand control of the terminal to their process group.This is likely to need more testing.
Things I've tested so far:
echo -s x(git branch | fzf | string trim)x(which would previously hang)echo (cat)(which would print a newline and leave a stopped cat)Also
sudoandpercol.Fixes issue #1362.
TODOs: