[Tutor] os.system sending of break signals

Liam Clarke ml.cyresse at gmail.com
Fri Oct 28 14:42:03 CEST 2005


On 10/28/05, Alan Gauld <alan.gauld at freenet.co.uk> wrote:
> > >>> f = os.popen2('ping 192.168.8.85 -c 100 > cap1.txt')
> > >>> f[0].write('\x03')
> >
> > Thank command works, but 'f[1]' is in read-only mode and I can't write
> > to it.
> > My command in the background is still not terminated.
>
> Thats almost certainly because ping never reads its input.
> In that case you'll need to send a kill signal to the process and
> to do that you need to find the process ID. I'm not sure if
> popen() provides access to the PID but if not you could
> either search for it (this might be too slow) or just drop
> down to use fork rather than popen, as fork will return
> the PID.

Would calling PS via another popen() and using string methods to get
the Pid work?
I'm rather new to Linux & Python...

Regards,

Liam Clarke


More information about the Tutor mailing list