Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Repost: Can't sys.exit() from SIGTERM handler?

Thread Tools

Repost: Can't sys.exit() from SIGTERM handler?

Andrew Athan
Posts: n/a

I have a python program (snippet below) which does not want to seem to die
when I issue a sys.exit() inside the SIGTERM handler. The output below is
generated as the result of sending several SIGTERM signals to the process,
as a result of seeing that it had not died.

I don't think this is relevant, but the application has fork()ed a child
process (cdparanoia). The only thing I can think of is that somehow, there
is an exception occuring inside sys.exit(), otherwise why am I not seeing
the "Did not sys.exit()!?" output? Could it be that exit() is returning but
that the output fd's are already closed?

Verrry strange...and therefore I'm sure I'm making a brain dead mistake.

Thanks in advance,





Ripper output status code: (4314, 15)
4320 /root/postprocess /var/music/ripper/8707620b


Error JOB_NODISC in job <__main__.JobHandler instance at 0x8204b24>
4321 /bin/setserial /dev/ttyS0 spd_normal


Killing child processes...


def sigterm(a,b):
print '\n****SIGTERM*****\n'
print '\nDid not sys.exit()??!!\n'
print '\nDid not os._exit()??!!\n'

def killChildren():
global childPIDs
print '\n\nKilling child processes...'
for pid in childPIDs:
print 'Terminating %d'%pid

def child_exit(a,b):
#childpid, status = os.wait()
print '\n****SIGCHILD*****\n'


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Child process does not exit after receiving SIGTERM Teresa C Programming 2 04-06-2004 01:26 AM
[SOLVED] RE: Repost: Can't sys.exit() from SIGTERM handler? Andrew Athan Python 0 01-06-2004 03:11 AM
RE: Repost: Can't sys.exit() from SIGTERM handler? Andrew Athan Python 0 01-06-2004 02:35 AM
popen3,4 and SIGTERM Zoran Bosnjak Python 0 10-15-2003 03:01 PM
robust clean-up with SIGTERM (was Re: Again, how to write a cleanup function for a module in C ) Jane Austine Python 2 08-16-2003 04:01 AM