I have a python script that starts other processes via subprocess.run(...). Usually such a process runs automatically without reading from stdin. However, in the case of an error the processes waits for user input. I want detect such a situation from the calling python script and then e.g. kill that process. How could I achieve this?
(My idea was to create a file-like object which raises an Exception when its .read() method is called and pass it to subprocess.Popen(...) as a "bait" for the stdin kwarg. However this seems somehow ugly because some fileno needed to be faked.)