Settings

Theme

The output of Linux pipes can be indeterministic

gibney.org

4 points by GamerUncle 3 years ago · 2 comments

Reader

Someone 3 years ago

Past discussion that clicking ‘past’ doesn’t show because it had a different url (https://utcc.utoronto.ca/~cks/space/blog/unix/ShellPipelineI... vs https://www.gibney.org/the_output_of_linux_pipes_can_be_inde...): https://news.ycombinator.com/item?id=19314681

(Referenced from the article)

bediger4000 3 years ago

I don't think this is a pipe issue.

(echo red; echo green 1>&2) | echo blue

The string "red" goes into the pipe. The strong "green" goes to stderr, the TTY. The "echo blue" writes to stdout, but does not read from its stdin, the read end of the pipe.

Since nothing gets read from the pipe I don't see the claim of indeterminacy as true.

The different outputs are all due to process scheduling in the kernel.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection