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

Hang when piping significant output from a built-in command to an external command #60

Open
reubeno opened this issue Jun 10, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@reubeno
Copy link
Owner

reubeno commented Jun 10, 2024

This easily reproduces by running something like declare | wc -l. Here's what's happening:

  • We synchronously invoke the declare built-in, with its stdout mapped to the writer end of a pipe we allocate.
  • declare writes quite a bit and, presumably, fills up the pipe's internal buffer. This causes declare to block on its next write.
  • wc -l hasn't yet been invoked, so nothing is reading from the reader end of the pipe. This means nothing is freeing up space in the pipe's internal buffer and nothing will unblock declare.

In the case above, wc needs to be spawned before the declare built-in has completed.

@reubeno reubeno added the bug Something isn't working label Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant