Check if piped-in process is blocked on input
+1
−0
Suppose I am the author of a shell utility called bar
. One common use case is in pipelines like foo | bar
, where foo
sometimes runs interactively. I want to distinguish situations where interaction is required from situations where foo
produces all its output up front and immediately exits.
Is it possible from within bar
to determine a) the process that's piping into it; b) whether that process is blocked on input? If it's possible, what system calls do I need?
0 comment threads