Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

15
  • 3
    @hugomg in that case, the pipe is totally irrelevant. Commented Nov 16, 2015 at 16:25
  • 4
    @hugomg because nothing in yes is connected to pipe. Commented Nov 16, 2015 at 16:27
  • 4
    It's true, that is a demonstration of the documented behavior "wait until all commands finish before terminating the pipeline". It just prevents yes from getting SIGPIPE, since the FD it's writing to isn't connected to a pipe. Commented Nov 16, 2015 at 16:27
  • 2
    @hugomg, it's looping forever in the same way that yes >/dev/null is looping forever. It demonstrates nothing at all about pipelines that isn't also true of simple commands (as the waiting-for-termination behavior Tom points out is true of simple commands as well). Commented Nov 16, 2015 at 17:11
  • 2
    @zwol: I think we are using our terms with slightly different meanings here, or thinking about things from slightly different perspectives… but in either case, write() (the function in libc) does not return (transfer control to the PC following it) until after the signal handler has run, but since the signal handler terminates the program, control is never transferred and therefore write() never returns. Yes, that's implemented in the kernel by having some xxx_write() function return -EPIPE, but we're debugging a user-space program and uninterested in that. Commented Nov 17, 2015 at 3:00