readd prevention of hanging when closing process streams on windows

This commit is contained in:
Eric 2025-03-07 16:25:16 +11:00
parent ee0d2866c8
commit e69319b5a2
No known key found for this signature in database

View File

@ -137,10 +137,19 @@ method stop*(
error = e.msg
writeStackTrace()
finally:
trace "closing node process' streams"
await node.process.closeWait()
node.process = nil
trace "node process' streams closed"
proc closeProcessStreams() {.async: (raises: []).} =
trace "closing node process' streams"
await node.process.closeWait()
node.process = nil
trace "node process' streams closed"
# windows will hang waiting to close process streams, so we can asyncspawn
# in the hopes that it will eventually close them without hanging the
# process
when defined(windows):
asyncSpawn closeProcessStreams()
else:
await closeProcessStreams()
proc waitUntilOutput*(
node: NodeProcess, output: string