From fbb5c8e2000ef111a696a695f75228cfc14b306f Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Fri, 5 Apr 2024 21:26:13 +0200 Subject: [PATCH] fix: avoid sending stdin_close if subprocess is already dead --- src/subprocess.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/subprocess.zig b/src/subprocess.zig index 40a1f81..53f6484 100644 --- a/src/subprocess.zig +++ b/src/subprocess.zig @@ -48,7 +48,7 @@ pub fn send(self: *const Self, bytes_: []const u8) tp.result { pub fn close(self: *Self) tp.result { defer self.deinit(); if (self.stdin_behavior == .Pipe) - if (self.pid) |pid| try pid.send(.{"stdin_close"}); + if (self.pid) |pid| if (!pid.expired()) try pid.send(.{"stdin_close"}); } pub fn writer(self: *Self) Writer {