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*

7
  • If the nc program goes away, the sox program will only get a sigpipe when the sox tries to write some data to the pipe. So sox needs to be outputting data. sox probably buffers output, so it might need to output several thousand characters before it actually tries to push the data through the pipe. Commented Nov 13, 2016 at 15:26
  • unix.stackexchange.com/questions/29964/… is related Commented Nov 13, 2016 at 15:33
  • Is there a way to bind their lifetimes together? I want all processes to terminate if one terminates. Commented Nov 13, 2016 at 17:05
  • or is there a way to kill the parent process when no data flows through the pipe for some time? Example usage: avconv | sox | check-data-flow-or-kill-parent | nc Commented Nov 13, 2016 at 17:11
  • Of course you can bind the lifetimes together. The question is do you want to? For example if sox exits before nc has sent out its data do you want it to exit, dropping the unsent information? Certainly one could write a check-data-flow-or-kill-parent, it is not hard. One caveat is that the parent may not be what you think it is, it depends on which shell creates the pipeline. What is the problem you are trying to solve? Would doing killall avconv solve your problem? If avconv goes away then sox will get eof on its input, and probably will exit, then nc will get eof... Commented Nov 13, 2016 at 17:24