Commit 5e6469e
fix(jobs): resolve portability issues with background job cleanup
The previous implementation executes "ps" with flags -p and -o to check
whether a job process was still running. This approach has portability
issues regarding e.g. BusyBox ps (Alpine Linux) where `ps -p` fails or
BSD/macOS where `ps -o` fails.
Replace with `posix_kill($pid, 0)`, the standard POSIX way to probe
process existence without delivering a signal. EPERM is treated as
"process exists but not owned by current user". This should be available
on all supported platforms.
Fixes: 60ce92a
Suggested-by: Michele Marcionelli
Signed-off-by: Stefan Kalscheuer <stefan@stklcode.de>1 parent 58c4667 commit 5e6469e
1 file changed
Lines changed: 3 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
55 | 53 | | |
56 | 54 | | |
57 | 55 | | |
| |||
0 commit comments