Reputation: 842
I have a shell script that runs for a while and then takes an input. I want to create the process:
process = subprocess.Popen(
'/my/longscript/wait.sh',
shell=True,
stdout=subprocess.PIPE,
stdin=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True
)
process
<subprocess.Popen at 0x7fb7b319ef60>
process.pid
10248
And then in a different session attach to this process and send it some stdin. How can I reattach to the process, using the pid, or how do I do this?
running_process = subprocess.attach_to_my_old_process(pid=10248)???
running_process.communicate(input='someinput')
Upvotes: 3
Views: 1692
Reputation: 5940
Turning my comment into an answer: you have to use a named pipe for this.
How this can be done was done I answered in your related question.
Upvotes: 3