Commit 2b890a5
committed
fix(tinytorch): don't use os.kill(pid, 0) as a liveness probe on Windows
The psutil-unavailable fallback in _running_jupyter_pid used
os.kill(pid, 0), assuming POSIX signal-0 "probe only" semantics. On
Windows, os.kill does not implement that: it calls TerminateProcess
for any signal value, including 0. The fallback path meant to check
whether a Jupyter server was still running would instead kill it.
psutil is already a required project dependency (requirements.txt,
tito setup's own package list), so this path should only be reached
in a broken environment. Removed the unsafe probe: if psutil can't be
imported, treat it the same as "can't tell" and return None, so the
caller launches a fresh server instead. Worst case is a duplicate
server (the same behavior this PR is fixing in the common case), never
silently killing a running one.1 parent ab82a5e commit 2b890a5
1 file changed
Lines changed: 10 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
525 | 525 | | |
526 | 526 | | |
527 | 527 | | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
535 | 538 | | |
536 | 539 | | |
537 | 540 | | |
| |||
0 commit comments