Skip to content
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

psub does not allow cooperative multitasking #2348

Closed
kwaze opened this issue Aug 31, 2015 · 5 comments
Closed

psub does not allow cooperative multitasking #2348

kwaze opened this issue Aug 31, 2015 · 5 comments

Comments

@kwaze
Copy link

kwaze commented Aug 31, 2015

In your Bash prompt enter less -f <(yes | awk '{print NR}'). Compare that to less (yes | awk '{print NR}' | psub) in Fish which makes the shell freeze.

@kwaze kwaze changed the title Process substitution does not allow cooperative multitasking psub does not allow cooperative multitasking Aug 31, 2015
@kwaze
Copy link
Author

kwaze commented Aug 31, 2015

The following works.
Using named pipes:

 mkfifo numbers.fifo
 yes | awk '{print NR}' > numbers.fifo&
 less numbers.fifo

and when you exit less, do

  rm numbers.fifo

Maybe psub could be changed to work that way?

@faho
Copy link
Member

faho commented Aug 31, 2015

That works. Maybe psub could be changed to work that way?

That's what psub is supposed to do unless invoked with the "-f"/"--file" option, but there's a bug. Try again with a17b9fd.

@faho
Copy link
Member

faho commented Aug 31, 2015

Oh, we actually already have a bug about this: #1040. Closing this as a duplicate.

@geoff-nixon
Copy link
Contributor

Actually, this is isn't #1040, its much more along the lines of #238 - #563 - #1396.
Basically, bash forks at all command and process substitutions, fish does not.

Using your example @kwaze, we can reproduce the same issue without sub with something like:

mkfifo numbers.fifo
function yesawk
  yes | awk '{print NR}'
end
yesawk > numbers.fifo &
... # hang

Which is definitely a big annoying fish bug. However, for your particular case, why is

yes | awk '{print NR}' | less -f

insufficient? Process substitution is always icky, even in other shells. Its all about the pipeline! 😉

@faho
Copy link
Member

faho commented Sep 24, 2015

Actually, this is isn't #1040, its much more along the lines of #238 - #563 - #1396.

Some combination of those as applied to psub is this and 1040.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants