I want to discover the PID of the producer process in a pipeline:
producer | consumer
I don't always control the producer process, I can request that they echo the PID from the producer like so:
log.info(JSON.stringify({pid: process.pid}) + '\n');
but is there any other way to discover what the PID of the producer might be?
If the pipeline is not a background process, then one clue would be that it's the most recent process created by the parent PID, which I do know.