diff options
| author | Victor Stinner <vstinner@python.org> | 2020-04-02 03:42:05 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-02 03:42:05 +0200 |
| commit | 9a679a0e47d58aa73b7747d4e16140048c10baf5 (patch) | |
| tree | 9b858a70736362f4d83ae20b0b94a4f2acd1af7b /Lib/http/server.py | |
| parent | e27916b1fc0364e3627438df48550c16f0b80b82 (diff) | |
| download | cpython-git-9a679a0e47d58aa73b7747d4e16140048c10baf5.tar.gz | |
bpo-40094: CGIHTTPRequestHandler logs exit code (GH-19285)
CGIHTTPRequestHandler of http.server now logs the CGI script exit
code, rather than the CGI script exit status of os.waitpid().
For example, if the script is killed by signal 11, it now logs:
"CGI script exit code -11."
Diffstat (limited to 'Lib/http/server.py')
| -rw-r--r-- | Lib/http/server.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/http/server.py b/Lib/http/server.py index 2d74b95586..fa204fbc15 100644 --- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -1164,8 +1164,9 @@ class CGIHTTPRequestHandler(SimpleHTTPRequestHandler): while select.select([self.rfile], [], [], 0)[0]: if not self.rfile.read(1): break - if sts: - self.log_error("CGI script exit status %#x", sts) + exitcode = os.waitstatus_to_exitcode(sts) + if exitcode: + self.log_error(f"CGI script exit code {exitcode}") return # Child try: |
