Skip to content

Commit 1227295

Browse files
[3.15] gh-155031: Report subprocess permission errors to the user (GH-155032) (#162383)
Report permission errors from child profiler processes to the user instead of discarding their standard error.
1 parent 474a772 commit 1227295

3 files changed

Lines changed: 3 additions & 2 deletions

File tree

‎Lib/profiling/sampling/__main__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ def handle_permission_error():
5858
print(WINDOWS_PERMISSION_ERROR, file=sys.stderr)
5959
else:
6060
print(GENERIC_PERMISSION_ERROR, file=sys.stderr)
61-
sys.exit(1)
6261

6362
if __name__ == '__main__':
6463
try:
6564
main()
6665
except PermissionError:
6766
handle_permission_error()
67+
sys.exit(1)
6868
except SamplingUnknownProcessError as err:
6969
print(f"Tachyon cannot find the process: {err}", file=sys.stderr)
7070
sys.exit(1)

‎Lib/profiling/sampling/_child_monitor.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ def _spawn_profiler_for_child(self, child_pid):
237237
cmd,
238238
stdin=subprocess.DEVNULL,
239239
stdout=subprocess.DEVNULL,
240-
stderr=subprocess.DEVNULL,
241240
)
242241
with self._lock:
243242
if self._stop_event.is_set():
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Propagate to user any permission errors from subprocess attach commands in
2+
Tachyon

0 commit comments

Comments
 (0)