ctrl-c and os.system problem

Donn Cave donn at u.washington.edu
Tue Apr 2 17:39:21 EST 2002


Quoth Noom Knews <noomnews at yahoo.com>:
| I have a simple program like this
|
| os.system("ls -lR / > /tmp/ls.out")
| print "end"
|
| When I press ctrl-c, the "end" message is still print.
|  I'd like to terminate the whole process when pressing
| ctrl-c instead of just "end".
|
| I tried to catch the signal already but can't catch
| the SIGINT or anything else at all during the
| os.system call.   This does not work either
...
| This was tried on Redhat Linux with python 1.5.2

NetBSD's system(3) man page explains that system ignores SIGINT
and SIGQUIT.  I assume the same must be true on Red Hat Linux,
and Python calls C system().

Maybe you could use spawnv()?

	Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list