diff --git a/Lib/profiling/sampling/__main__.py b/Lib/profiling/sampling/__main__.py index a45b645eae05fc4..c0e022ca4d0fa79 100644 --- a/Lib/profiling/sampling/__main__.py +++ b/Lib/profiling/sampling/__main__.py @@ -58,13 +58,13 @@ def handle_permission_error(): print(WINDOWS_PERMISSION_ERROR, file=sys.stderr) else: print(GENERIC_PERMISSION_ERROR, file=sys.stderr) - sys.exit(1) if __name__ == '__main__': try: main() except PermissionError: handle_permission_error() + sys.exit(1) except SamplingUnknownProcessError as err: print(f"Tachyon cannot find the process: {err}", file=sys.stderr) sys.exit(1) diff --git a/Lib/profiling/sampling/_child_monitor.py b/Lib/profiling/sampling/_child_monitor.py index ec56f75719f9d17..7c73ec26d88a33e 100644 --- a/Lib/profiling/sampling/_child_monitor.py +++ b/Lib/profiling/sampling/_child_monitor.py @@ -237,7 +237,6 @@ def _spawn_profiler_for_child(self, child_pid): cmd, stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL, ) with self._lock: if self._stop_event.is_set(): diff --git a/Misc/NEWS.d/next/Library/2026-08-01-10-54-39.gh-issue-155031.sTB_n8.rst b/Misc/NEWS.d/next/Library/2026-08-01-10-54-39.gh-issue-155031.sTB_n8.rst new file mode 100644 index 000000000000000..954e4cc2e54ac04 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-08-01-10-54-39.gh-issue-155031.sTB_n8.rst @@ -0,0 +1,2 @@ +Propagate to user any permission errors from subprocess attach commands in +Tachyon