Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lib/profiling/sampling/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand this. sys.exit() is already called within the handler.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to commit removing the sys.exit call from there, my bad. Seems less confusing to have all code in the except paths ending with sys.exit than to call it from the helper function

except SamplingUnknownProcessError as err:
print(f"Tachyon cannot find the process: {err}", file=sys.stderr)
sys.exit(1)
Expand Down
1 change: 0 additions & 1 deletion Lib/profiling/sampling/_child_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Propagate to user any permission errors from subprocess attach commands in
Tachyon
Loading