attach to process by pid?

Alexander Kapps alex.kapps at web.de
Thu Mar 10 17:55:51 EST 2011


On 10.03.2011 23:25, Nobody wrote:
> On Thu, 10 Mar 2011 20:22:11 +0100, Giampaolo Rodolà wrote:
>
>> I think he wants to attach to another process's stdin/stdout and
>> read/write from/to them.
>> I don't know if this is possible but it would be a great addition for psutil.
>
> It's not even a meaningful concept, let alone possible.

Unless I misunderstand something, it is possible (at least on Linux):

Two terminal windows:

1:
alex at frittenbude:~$ grep foobar

2:
alex at frittenbude:~$ ps ax|grep 'grep foobar'
13075 pts/4    S+     0:00 grep --color=auto grep foobar
alex at frittenbude:~$ echo foobar > /proc/13075/fd/0

That this is *highly* system dependent, problematic in many regards 
and just terrible hackery is another issue.




More information about the Python-list mailing list