ctrl-c and os.system problem

Maik Hertha maik.hertha at volkswagen.de
Wed Apr 3 01:57:59 EST 2002


Noom Knews wrote:

>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
>
>try:
>   os.system("ls -lR / > /tmp/ls.out")
>   print "end"
>except:
>   print "get all exception"
>
>This will keep printing "end" when ctrl-c is pressed
>too. I think this could be os.system problem. If I use
>other statement instead of os.system, the program
>works as I expected.
>
>This was tried on Redhat Linux with python 1.5.2
>
works on python 2.2

-- 

mit freundlichem Gruß /
best regards

Maik Hertha

--------------------------------------------------- h+h
EBSP Anwenderbetreuung, +49 5361 9-74950
Volkswagen AG / Brieffach 1721 / D-38436 Wolfsburg
http://ebsp.wob.vw.de              
maik.hertha at volkswagen.de
---------------------------------------------------
hartmann+hertha
it (beratung / entwicklung / support)
http://www.hartmann-hertha.de
mhertha at hartmann-hertha.de
--------------------------------------------------- h+h





More information about the Python-list mailing list