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?