Skip to content

Commit 9a679a0

Browse files
authored
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."
1 parent e27916b commit 9a679a0

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Lib/http/server.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,8 +1164,9 @@ def run_cgi(self):
11641164
while select.select([self.rfile], [], [], 0)[0]:
11651165
if not self.rfile.read(1):
11661166
break
1167-
if sts:
1168-
self.log_error("CGI script exit status %#x", sts)
1167+
exitcode = os.waitstatus_to_exitcode(sts)
1168+
if exitcode:
1169+
self.log_error(f"CGI script exit code {exitcode}")
11691170
return
11701171
# Child
11711172
try:
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CGIHTTPRequestHandler of http.server now logs the CGI script exit code,
2+
rather than the CGI script exit status of os.waitpid(). For example, if the
3+
script is killed by signal 11, it now logs: "CGI script exit code -11."

0 commit comments

Comments
 (0)