[issue11727] Add a --timeout option to regrtest.py using the faulthandler module

Charles-Francois Natali report at bugs.python.org
Thu Mar 31 16:25:57 CEST 2011


Charles-Francois Natali <neologix at free.fr> added the comment:

> There is something interesting in this output: the test uses a subprocess and we only have the traceback of the parent. It may be nice to have the trace of the child process. It might be possible by sending a signal to the child process (but how can we get the list of the child processes in a C signal handler?).

I don't think you can find that, but you could send a signal to the whole process group:
if (getpgrp() == getpid()) {
    kill(-getpgrp(), <signal>);
}

The getpgrp() == getpid() makes sure that you'll only do that if the current process is the group leader (and it's async-safe). You'll probably want to block <signal> in the parent's handler first.
Note that it won't work if your child process calls setsid(), of course (start_new_session argument to Popen).

----------
nosy: +neologix

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11727>
_______________________________________


More information about the Python-bugs-list mailing list