mirror of
https://github.com/python/cpython.git
synced 2025-08-08 02:48:55 +00:00
Make the ctl-C shutdown of serve.py prettier.
This commit is contained in:
parent
e5d1c05216
commit
cbd7d3dbf2
1 changed files with 5 additions and 2 deletions
|
@ -28,5 +28,8 @@ if __name__ == '__main__':
|
|||
path = sys.argv[1]
|
||||
port = int(sys.argv[2]) if len(sys.argv) > 2 else 8000
|
||||
httpd = simple_server.make_server('', port, app)
|
||||
print "Serving %s on port %s" % (path, port)
|
||||
httpd.serve_forever()
|
||||
print "Serving %s on port %s, control-C to stop" % (path, port)
|
||||
try:
|
||||
httpd.serve_forever()
|
||||
except KeyboardInterrupt:
|
||||
print "\b\bShutting down."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue