diff options
author | 2022-10-10 20:57:38 -0700 | |
---|---|---|
committer | 2022-10-10 20:57:38 -0700 | |
commit | 3cc61f8e30f494c10de08de8afcf7bef3dd67fec (patch) | |
tree | 11066938a4014f211aa286e93e9d5cfa66b8b567 /src | |
parent | ef2c9c330c1cf6a79a27d9ce06af1bdc7b5b18b6 (diff) | |
download | bun-3cc61f8e30f494c10de08de8afcf7bef3dd67fec.tar.gz bun-3cc61f8e30f494c10de08de8afcf7bef3dd67fec.tar.zst bun-3cc61f8e30f494c10de08de8afcf7bef3dd67fec.zip |
Fix issue with exit callback in Bun.spawn() never firing
Diffstat (limited to '')
-rw-r--r-- | src/bun.js/base.zig | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/bun.js/base.zig b/src/bun.js/base.zig index 59cad571b..199a1c381 100644 --- a/src/bun.js/base.zig +++ b/src/bun.js/base.zig @@ -4017,6 +4017,20 @@ pub const Strong = struct { return result; } + pub fn has(this: *Strong) bool { + var ref = this.ref orelse return false; + return ref.get() != .zero; + } + + pub fn trySwap(this: *Strong) ?JSValue { + const result = this.swap(); + if (result == .zero) { + return null; + } + + return result; + } + pub fn set(this: *Strong, globalThis: *JSC.JSGlobalObject, value: JSValue) void { var ref: *JSC.napi.Ref = this.ref orelse { if (value == .zero) return; |