Issue120

If you're reporting an issue for setuptools 0.7 or higher, please use BitBucket

Title cli.exe quits on ctrl-c, but python doesn't
Priority bug Status chatting
Superseder Nosy List guyroz, pje
Assigned To Keywords

Created on 2011-01-21.00:37:30 by guyroz, last changed 2011-05-24.12:09:24 by guyroz.

Files
File name Uploaded Type Edit Remove
launcher.c.patch guyroz, 2011-01-21.10:07:12 application/octet-stream
launcher.c.patch guyroz, 2011-02-06.09:57:56 text/plain
Messages
msg629 (view) Author: guyroz Date: 2011-05-24.12:09:24
pje, can you please add the patch to the trunk?

Thanks,
Guy
msg580 (view) Author: guyroz Date: 2011-02-06.09:57:56
This patch passes the unit tests
msg578 (view) Author: pje Date: 2011-01-21.18:25:09
At 04:40 PM 1/21/2011 +0000, Guy Rozendorn wrote:
>I can make a refined patch if you need.

If you send me one that passes the test suite, I'll have it in the 
development snapshot versions for you ASAP.  If I have to do the 
testing and debugging myself, it'll be a lot longer before I get around to it.
msg577 (view) Author: guyroz Date: 2011-01-21.16:40:58
you're right, that was the intention: translating it to:
"%s %s" % (ptr, ' '.join(newargs))

I can make a refined patch if you need.
msg576 (view) Author: pje Date: 2011-01-21.15:50:41
At 10:07 AM 1/21/2011 +0000, Guy Rozendorn wrote:
>Attached is a patch draft, just wrote it w/o compiling and making 
>sure it really works.

Most of it looks straightforward, but I'm a little confused by the 
part that turns argv back into a command line.  It looks like it's 
just gluing the arguments together with no spaces in between.
msg575 (view) Author: guyroz Date: 2011-01-21.10:07:12
The idea is to set an internal control event handler, rather than using the default one (that kills the cli).
the new handler should pass the ctrl-c event to the python child pid, by using GenerateConsoleCtrlEvent.
the new handler is set by using SetConsoleCtrlHandler.

so you need a control handler function, and to set it up.
you also need the child pid (to send the ctrl-c to), but spawnv doesn't return it. so you also need to move to CreateProcessA and WaitForSingleObject.
in order to use CreateProcess, you need to convert ptr and newchars into one big char*.

Attached is a patch draft, just wrote it w/o compiling and making sure it really works.
msg574 (view) Author: pje Date: 2011-01-21.03:09:11
Can you supply a patch?  From what I can tell, SetConsoleCtrlHandler is inherited by the child process, so wouldn't that make Python ignore it too?

Thanks.
msg573 (view) Author: guyroz Date: 2011-01-21.00:37:29
the cli should use SetConsoleCtrlHandler to ignore CTRL-C and pass it to its child process
History
Date User Action Args
2011-05-24 12:09:24guyrozsetmessages: + msg629
2011-02-06 09:57:56guyrozsetfiles: + launcher.c.patch
messages: + msg580
2011-01-21 18:25:10pjesetmessages: + msg578
2011-01-21 16:40:58guyrozsetmessages: + msg577
2011-01-21 15:50:41pjesetmessages: + msg576
2011-01-21 10:07:12guyrozsetfiles: + launcher.c.patch
messages: + msg575
2011-01-21 03:09:11pjesetstatus: unread -> chatting
nosy: + pje
messages: + msg574
2011-01-21 00:37:30guyrozcreate