GH-142591: Tachyon does not handle non-existent file/module#142592
GH-142591: Tachyon does not handle non-existent file/module#142592pablogsal merged 6 commits intopython:mainfrom
Conversation
|
Hmm, there's a better fix here. Please hold :D |
Lib/profiling/sampling/cli.py
Outdated
| """Handle live mode for an existing process.""" | ||
| # Check if process exists | ||
| try: | ||
| os.kill(pid, 0) |
There was a problem hiding this comment.
I am not sure this works on windows. On Windows, os.kill() only supports signals SIGTERM, CTRL_C_EVENT, and CTRL_BREAK_EVENT. Signal 0 (which is the Unix idiom for checking if a process exists without sending a signal) is not supported on Windows.
There was a problem hiding this comment.
This also has a TOCTOU problem: the process may die after you check and before we attach
There was a problem hiding this comment.
The fix probably needs to be done more on the line of https://github.com/python/cpython/pull/142655/changes (we should handle this there)
|
I've made some improvements to the implementation.
|
fe664f9 to
980b035
Compare
980b035 to
24086c8
Compare
pablogsal
left a comment
There was a problem hiding this comment.
LGTM
Thanks a lot for the PR @savannahostrowski ❤️
This validates script/module/PID exists before starting the profiler. If the target doesn't exist, we now fail fast with a clear error instead of launching an empty TUI.