diff options
author | Stéphane Wirtel <stephane@wirtel.be> | 2019-04-16 12:52:54 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-16 12:52:54 (GMT) |
commit | 2b7f93b99afbe78e4e567d9252d9470d29f387c8 (patch) | |
tree | d55ea2d06b9c3f31d3011ae66a583f011e8c8963 /Tools | |
parent | 6fa84bd12c4b83bee6a41b989363230d5c03b96c (diff) | |
download | cpython-2b7f93b99afbe78e4e567d9252d9470d29f387c8.zip cpython-2b7f93b99afbe78e4e567d9252d9470d29f387c8.tar.gz cpython-2b7f93b99afbe78e4e567d9252d9470d29f387c8.tar.bz2 |
bpo-36345: Update wsgiref example (GH-12562)
Use literalinclude markup to include Tools/scripts/serve.py code.
Tools/scripts/serve.py first argument on the command line is now optional.
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/scripts/serve.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Tools/scripts/serve.py b/Tools/scripts/serve.py index dae21f2..7ac9c10 100755 --- a/Tools/scripts/serve.py +++ b/Tools/scripts/serve.py @@ -25,11 +25,12 @@ def app(environ, respond): return [b'not found'] if __name__ == '__main__': - path = sys.argv[1] + path = sys.argv[1] if len(sys.argv) > 1 else os.getcwd() port = int(sys.argv[2]) if len(sys.argv) > 2 else 8000 httpd = simple_server.make_server('', port, app) print("Serving {} on port {}, control-C to stop".format(path, port)) try: httpd.serve_forever() except KeyboardInterrupt: - print("\b\bShutting down.") + print("Shutting down.") + httpd.server_close() |