diff options
author | 2022-09-28 23:38:54 -0700 | |
---|---|---|
committer | 2022-09-28 23:38:54 -0700 | |
commit | e69e8d35b9044074c3ef3ff59ebdaa520068df64 (patch) | |
tree | c24ed091b73b0ccdaedd0b4d117716a5ba191027 | |
parent | 9438540bf9dac4c9a5c2ac858233abcc8e1fa446 (diff) | |
download | bun-e69e8d35b9044074c3ef3ff59ebdaa520068df64.tar.gz bun-e69e8d35b9044074c3ef3ff59ebdaa520068df64.tar.zst bun-e69e8d35b9044074c3ef3ff59ebdaa520068df64.zip |
Fix `unreachable`
-rw-r--r-- | src/bun.js/webcore/streams.zig | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/bun.js/webcore/streams.zig b/src/bun.js/webcore/streams.zig index 2695a43e2..65a34f0ce 100644 --- a/src/bun.js/webcore/streams.zig +++ b/src/bun.js/webcore/streams.zig @@ -7,7 +7,7 @@ const ZigURL = @import("../../url.zig").URL; const HTTPClient = @import("http"); const NetworkThread = HTTPClient.NetworkThread; const AsyncIO = NetworkThread.AsyncIO; -const JSC = @import("root").JSC; +const JSC = @import("javascript_core"); const js = JSC.C; const Method = @import("../../http/method.zig").Method; @@ -1118,9 +1118,12 @@ pub const FileSink = struct { } fn cleanup(this: *FileSink) void { - this.unwatch(this.fd); - if (this.fd != std.math.maxInt(JSC.Node.FileDescriptor)) { + if (this.scheduled_count > 0) { + this.scheduled_count = 0; + this.unwatch(this.fd); + } + _ = JSC.Node.Syscall.close(this.fd); this.fd = std.math.maxInt(JSC.Node.FileDescriptor); } |