Jim Meyering <[EMAIL PROTECTED]> wrote: > 2006-12-08 Jim Meyering <[EMAIL PROTECTED]> > > * tests/Makefile.am (run-python-tests): Kill qpidd via a trap. > Don't let a failed/interrupted "make check" leave a running > qpidd process.
This patch deserves a little explanation. The dual-trap is an idiom (if you don't know it, it looks daunting): The second one traps signals (INT, TERM, etc) and propagates the nonzero exit code to process exit code. The first one (the trap '...' 0) handles a normal exit, including any signal-induced exit from the other trap. > Index: tests/Makefile.am > =================================================================== > --- tests/Makefile.am (revision 484695) > +++ tests/Makefile.am (working copy) > @@ -71,9 +71,10 @@ > DllPlugInTester -c -b .libs/*.so > > run-python-tests: $(check_LTLIBRARIES) ../src/qpidd > - ../src/qpidd > qpidd.log 2>&1 & echo $$! > qpidd.pid > + ../src/qpidd > qpidd.log 2>&1 & pid=$$!; \ > + trap 'status=$$?; kill $$pid; exit $$status' 0; \ > + trap '(exit $$?); exit $$?' 1 2 13 15; \ > cd ../../python ; ./run-tests -v -I cpp_failing.txt > - kill `cat qpidd.pid` > > include gen.mk
