Aug-20-2020, 10:12 AM
Hi,
I'm working on a program that launch multiple subprocess in background.
Those processes return data continuously so I piped stdout to a file, to retrieve it later while running, with a command like myApp --show processName
So I'm wondering if there's any way to get the stdout of a running process with it's pid?
Thanks
I'm working on a program that launch multiple subprocess in background.
Those processes return data continuously so I piped stdout to a file, to retrieve it later while running, with a command like myApp --show processName
subprocess.Popen(cmd, stdout=logfile, stderr=logfile, text=True)It works fine, I loop over the file by reading lines but it's slow and I lose the colored formated text (warnings and errors) threw by the command. It's faster when reading /proc/pid/fd/1 but still slow.
So I'm wondering if there's any way to get the stdout of a running process with it's pid?
Thanks