attach to process by pid?

James Mills prologic at shortcircuit.net.au
Thu Mar 10 18:22:03 EST 2011


On Fri, Mar 11, 2011 at 8:55 AM, Alexander Kapps <alex.kapps at web.de> wrote:
> On 10.03.2011 23:25, Nobody wrote:
> 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

This works fine on the Linux platform (perhaps other UNIX-like
platforms have similar concepts). You're simply writing to
the processes's stdin (file descriptor of 0)

Probably not a portable solution.

cheers
James

-- 
-- James Mills
--
-- "Problems are solved by method"



More information about the Python-list mailing list