terminate process before waiting for exit with timeout

solved an issue on windows where the processes were not exiting cleanly and causing an attempted write to the dht db after the data dir had already been deleted
This commit is contained in:
Eric 2023-12-01 13:38:26 +11:00
parent cccec6574c
commit ec5cf2ad96
No known key found for this signature in database

View File

@ -120,8 +120,12 @@ method stop*(node: NodeProcess) {.base, async.} =
await node.trackedFutures.cancelTracked()
if node.process != nil:
try:
trace "terminating node process..."
if errCode =? node.process.terminate().errorOption:
error "failed to terminate process", errCode
trace "waiting for node process to exit"
let exitCode = await node.process.waitForExit(ZeroDuration)
let exitCode = await node.process.waitForExit(3.seconds)
if exitCode > 0:
error "failed to exit process, check for zombies", exitCode