Fix daemon exiting after 5s on macOS due to PID 1 parent monitoring (GH #278)
Amp-Thread-ID: https://ampcode.com/threads/T-87e6732c-f7bf-4e8d-9ebc-f778ac6f0c40 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -83,8 +83,9 @@ func checkParentProcessAlive(parentPID int) bool {
|
||||
}
|
||||
|
||||
if parentPID == 1 {
|
||||
// Adopted by init - parent died
|
||||
return false
|
||||
// Adopted by init/launchd - this is normal for detached daemons on macOS/Linux
|
||||
// Don't treat this as parent death
|
||||
return true
|
||||
}
|
||||
|
||||
// Check if parent process is running
|
||||
|
||||
Reference in New Issue
Block a user