Closed anrddh closed 3 months ago
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
I've encountered lots of subtle bugs around fork
, exec
, kill
, wait
and friends before, so I usually read code that uses them very carefully :)
It's fairly hard to use those syscalls correctly. I've even found discussion for this sort of thing in the Go standard library: https://github.com/golang/go/commit/cea29c4a358004d84d8711a07628c2f856b381e8 https://github.com/golang/go/issues/9382 https://github.com/golang/go/issues/13987
This protects us from a potential (but rare) race condition where
os.Process.Wait
callbefore our signal actually gets sent.
This is achieved by using the higher-level
os.Process
API directly, which has some synchronization to preventos.Process.Wait
andos.Process.Signal
from racing.