Sample Header Ad - 728x90

How to determine if a process is part of a pipeline (producer in pipeline)?

0 votes
0 answers
36 views
So if I am in my terminal and run: $ my_proc | grep foo in my_prof I know it's part of a pipeline because stdout is not attached to the terminal but to grep. On the other hand, if I just run this: $ my_proc in the terminal, then stdout is attached to the TTY, so I know that it's not part of a pipeline. However, if I run my_proc programmatically outside of the context of a terminal, how can I know if it's part of a pipeline or not? Or perhaps a better way to phrase the question, is there a way to discover what device/process is listening to the stdio from my_proc?
Asked by user356473
Jul 18, 2019, 06:35 AM
Last activity: Jul 18, 2019, 10:10 AM