signal through popen2
Philip Swartzleonard
starx at pacbell.net
Sun Feb 10 00:03:22 EST 2002
Lei Chen || Sat 09 Feb 2002 08:47:15p:
> Hi,
>
> I would like to send a CTRL-C on a process opened by popen2. Is this
> possible?
>
I haven't used popen's before, but i assume you have some method of
sending a string through it? Then sure, you just have to look up the
character number that you get from a ctrl-c, i'm not sure what it is.
But to send, say, a tab, linefeed, and carrage return through (using the
raw numbers), you would have a string like
"\x09\x0a\x0d"
(if you type this in a shell python will display it as '\t\n\r')
So you would have something like mypipe.write('\xNN'), where NN is the
hex number of whatever it is ctrl-c does.
But then, the real way of doing what you want to do may be slighly
different... like closing a socket to produce a proper eof signal...
--
Philip Sw "Starweaver" [rasx] :: www.rubydragon.com
More information about the Python-list
mailing list