comparison tests/test-static-http.t @ 13208:b6693876c250

test-static-http.t: get kill actually working - signal handlers take two arguments, not one - add missing import sys Before this patch, the $ kill $! at the end of the test just caused a hidden traceback, sys.exit(0) was not executed. The swallowed traceback was: Traceback (most recent call last): File "dumb.py", line 10, in <module> run() File "dumb.py", line 7, in run httpd.serve_forever() File "/usr/lib/python2.6/SocketServer.py", line 224, in serve_forever r, w, e = select.select([self], [], [], poll_interval) TypeError: <lambda>() takes exactly 1 argument (2 given)
author Adrian Buehlmann <adrian@cadifra.com>
date Sun, 26 Dec 2010 11:59:07 +0100
parents b00eda50ad2b
children 501f979d26b6
comparison
equal deleted inserted replaced
13207:1775382ff833 13208:b6693876c250
8 8
9 This server doesn't do range requests so it's basically only good for 9 This server doesn't do range requests so it's basically only good for
10 one pull 10 one pull
11 11
12 $ cat > dumb.py <<EOF 12 $ cat > dumb.py <<EOF
13 > import BaseHTTPServer, SimpleHTTPServer, os, signal 13 > import BaseHTTPServer, SimpleHTTPServer, os, signal, sys
14 > 14 >
15 > def run(server_class=BaseHTTPServer.HTTPServer, 15 > def run(server_class=BaseHTTPServer.HTTPServer,
16 > handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler): 16 > handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler):
17 > server_address = ('localhost', int(os.environ['HGPORT'])) 17 > server_address = ('localhost', int(os.environ['HGPORT']))
18 > httpd = server_class(server_address, handler_class) 18 > httpd = server_class(server_address, handler_class)
19 > httpd.serve_forever() 19 > httpd.serve_forever()
20 > 20 >
21 > signal.signal(signal.SIGTERM, lambda x: sys.exit(0)) 21 > signal.signal(signal.SIGTERM, lambda x, y: sys.exit(0))
22 > run() 22 > run()
23 > EOF 23 > EOF
24 $ python dumb.py 2>/dev/null & 24 $ python dumb.py 2>/dev/null &
25 $ echo $! >> $DAEMON_PIDS 25 $ echo $! >> $DAEMON_PIDS
26 $ mkdir remote 26 $ mkdir remote