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."
This commit is contained in:
Victor Stinner 2020-04-02 03:42:05 +02:00 committed by GitHub
parent e27916b1fc
commit 9a679a0e47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -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:

View File

@ -0,0 +1,3 @@
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."