If I do this:
x | y
is there any way to check, during the runtime of x, to see if it's connected to y? Note that I don't know what y is, and I am not responsible for starting y.
Specifically, I am talking about the Node.js runtime, so perhaps this is a Node.js specific question. But ultimately, I am wondering if it's possible to determine given any runtime. Is it possible and how?
Is it possible to determine if the stdout/stderr are hooked up to the stdin of another process? I guess that's what this question is about.