diff options
author | R. David Murray <rdmurray@bitdance.com> | 2010-05-31 23:23:50 (GMT) |
---|---|---|
committer | R. David Murray <rdmurray@bitdance.com> | 2010-05-31 23:23:50 (GMT) |
commit | 5ab2e7403638ef0d67de6c8464bded2daa9820d6 (patch) | |
tree | 8a4d82628d2d991cf9642f7e79a352fe885a51c8 | |
parent | 1790bc43bf8430b219116f4af0423c3a732c9eb8 (diff) | |
download | cpython-5ab2e7403638ef0d67de6c8464bded2daa9820d6.zip cpython-5ab2e7403638ef0d67de6c8464bded2daa9820d6.tar.gz cpython-5ab2e7403638ef0d67de6c8464bded2daa9820d6.tar.bz2 |
Merged revisions 81587 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r81587 | r.david.murray | 2010-05-28 14:17:20 -0400 (Fri, 28 May 2010) | 2 lines
Make the ctl-C shutdown of serve.py prettier.
........
-rwxr-xr-x | Tools/scripts/serve.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Tools/scripts/serve.py b/Tools/scripts/serve.py index 6b1321a..c3b7bdb 100755 --- a/Tools/scripts/serve.py +++ b/Tools/scripts/serve.py @@ -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 {} on port {}".format(path, port)) - httpd.serve_forever() + print("Serving {} on port {}, control-C to stop".format(path, port)) + try: + httpd.serve_forever() + except KeyboardInterrupt: + print("\b\bShutting down.") |