aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-11-25 20:27:59 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-11-25 20:27:59 -0800
commit14b063d8026fa4add63d4b912f8218089615285d (patch)
treeed6b78b7d5079f5c8c7df2e8266043a36fa2ffcc
parent99fa95b954f5eb7b02253d197f79933ff985fa5b (diff)
downloadbun-14b063d8026fa4add63d4b912f8218089615285d.tar.gz
bun-14b063d8026fa4add63d4b912f8218089615285d.tar.zst
bun-14b063d8026fa4add63d4b912f8218089615285d.zip
Simplify
-rw-r--r--src/bun.js/api/bun/subprocess.zig12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/bun.js/api/bun/subprocess.zig b/src/bun.js/api/bun/subprocess.zig
index 2f233ed81..14febbd00 100644
--- a/src/bun.js/api/bun/subprocess.zig
+++ b/src/bun.js/api/bun/subprocess.zig
@@ -275,7 +275,6 @@ pub const Subprocess = struct {
if (this.hasKilled()) {
return .{ .result = {} };
}
- this.killed = true;
if (comptime Environment.isLinux) {
// should this be handled differently?
@@ -290,9 +289,8 @@ pub const Subprocess = struct {
if (rc != 0) {
const errno = std.os.linux.getErrno(rc);
// if the process was already killed don't throw
- if (errno == .SRCH) return .{ .result = {} };
-
- return .{ .err = JSC.Node.Syscall.Error.fromCode(errno, .kill) };
+ if (errno != .SRCH)
+ return .{ .err = JSC.Node.Syscall.Error.fromCode(errno, .kill) };
}
} else {
const err = std.c.kill(this.pid, sig);
@@ -300,12 +298,12 @@ pub const Subprocess = struct {
const errno = std.c.getErrno(err);
// if the process was already killed don't throw
- if (errno == .SRCH) return .{ .result = {} };
-
- return .{ .err = JSC.Node.Syscall.Error.fromCode(errno, .kill) };
+ if (errno != .SRCH)
+ return .{ .err = JSC.Node.Syscall.Error.fromCode(errno, .kill) };
}
}
+ this.killed = true;
return .{ .result = {} };
}