mirror of
https://github.com/morluto/rea.git
synced 2026-11-06 14:56:32 +00:00
fix(windows): end output streams before releasing owned handles
Settle local streams even when native handle release fails, retaining handle ownership and retry semantics until release succeeds. Reviewed-PR: #3230 Co-authored-by: qorvr <330186599+qorvr@users.noreply.github.com>
This commit is contained in:
1 parent
c482ddd6ad
commit
dd1c879580
2 files changed
+46
-3
No files matched your search
@@ -387,11 +387,13 @@ export class WindowsOwnedProcess extends EventEmitter {
|
||||
if (this.#closed) return;
|
||||
if (this.#timer !== undefined) clearTimeout(this.#timer);
|
||||
this.#clearBlockedWake();
|
||||
this.#authority.call("process_close", [this.#handle]);
|
||||
this.#closed = true;
|
||||
this.stdin?.destroy();
|
||||
if (!this.stdout.destroyed) this.stdout.end();
|
||||
if (!this.stderr.destroyed) this.stderr.end();
|
||||
// End local streams before releasing the native handle. If release fails,
|
||||
// the retained job can be retried without leaving output streams open.
|
||||
this.#authority.call("process_close", [this.#handle]);
|
||||
this.#closed = true;
|
||||
this.#settle?.();
|
||||
this.emit("close", this.exitCode, null);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user