mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-02-03 16:44:05 +00:00
fix nodeprocess not exiting
This commit is contained in:
parent
aebe655575
commit
fea4acbb89
@ -128,14 +128,7 @@ method stop*(node: NodeProcess, expectedErrCode: int = -1) {.base, async.} =
|
|||||||
error "failed to terminate process", errCode = $errCode
|
error "failed to terminate process", errCode = $errCode
|
||||||
|
|
||||||
trace "waiting for node process to exit"
|
trace "waiting for node process to exit"
|
||||||
var backoff = 8
|
let exitCode = await node.process.waitForExit(3.seconds)
|
||||||
while node.process.running().valueOr false:
|
|
||||||
backoff = min(backoff*2, 1024) # Exponential backoff
|
|
||||||
await sleepAsync(backoff)
|
|
||||||
|
|
||||||
let exitCode = node.process.peekExitCode().valueOr:
|
|
||||||
fatal "could not get exit code from process", error
|
|
||||||
return
|
|
||||||
|
|
||||||
if exitCode > 0 and
|
if exitCode > 0 and
|
||||||
exitCode != 143 and # 143 = SIGTERM (initiated above)
|
exitCode != 143 and # 143 = SIGTERM (initiated above)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user