diff --git a/cmake/targets/BuildLibuv.cmake b/cmake/targets/BuildLibuv.cmake index feba612c44..de95e20955 100644 --- a/cmake/targets/BuildLibuv.cmake +++ b/cmake/targets/BuildLibuv.cmake @@ -4,7 +4,8 @@ register_repository( REPOSITORY libuv/libuv COMMIT - da527d8d2a908b824def74382761566371439003 + # Corresponds to v1.51.0 + 5152db2cbfeb5582e9c27c5ea1dba2cd9e10759b ) if(WIN32) diff --git a/src/bun.js/bindings/libuv/uv/version.h b/src/bun.js/bindings/libuv/uv/version.h index 6356e1ee44..77432f2595 100644 --- a/src/bun.js/bindings/libuv/uv/version.h +++ b/src/bun.js/bindings/libuv/uv/version.h @@ -31,10 +31,10 @@ */ #define UV_VERSION_MAJOR 1 -#define UV_VERSION_MINOR 50 -#define UV_VERSION_PATCH 1 -#define UV_VERSION_IS_RELEASE 0 -#define UV_VERSION_SUFFIX "dev" +#define UV_VERSION_MINOR 51 +#define UV_VERSION_PATCH 0 +#define UV_VERSION_IS_RELEASE 1 +#define UV_VERSION_SUFFIX "" #define UV_VERSION_HEX ((UV_VERSION_MAJOR << 16) | \ (UV_VERSION_MINOR << 8) | \ diff --git a/src/bun.js/webcore/FileReader.zig b/src/bun.js/webcore/FileReader.zig index 33dcc82036..d91d5ffb3a 100644 --- a/src/bun.js/webcore/FileReader.zig +++ b/src/bun.js/webcore/FileReader.zig @@ -351,6 +351,14 @@ pub fn onReadChunk(this: *@This(), init_buf: []const u8, state: bun.io.ReadState else => @panic("Invalid state"), } } else if (this.pending.state == .pending) { + // Certain readers (such as pipes) may return 0-byte reads even when + // not at EOF. Consequently, we need to check whether the reader is + // actually done or not. + if (buf.len == 0 and state == .drained) { + // If the reader is not done, we still want to keep reading. + return true; + } + defer { this.pending_value.clearWithoutDeallocation(); this.pending_view = &.{}; diff --git a/src/deps/libuv.zig b/src/deps/libuv.zig index 220d439973..e3b1837f1b 100644 --- a/src/deps/libuv.zig +++ b/src/deps/libuv.zig @@ -143,10 +143,10 @@ pub const UV__ENODATA = -@as(c_int, 4024); pub const UV__EUNATCH = -@as(c_int, 4023); pub const UV_VERSION_H = ""; pub const UV_VERSION_MAJOR = @as(c_int, 1); -pub const UV_VERSION_MINOR = @as(c_int, 46); -pub const UV_VERSION_PATCH = @as(c_int, 1); -pub const UV_VERSION_IS_RELEASE = @as(c_int, 0); -pub const UV_VERSION_SUFFIX = "dev"; +pub const UV_VERSION_MINOR = @as(c_int, 51); +pub const UV_VERSION_PATCH = @as(c_int, 0); +pub const UV_VERSION_IS_RELEASE = @as(c_int, 1); +pub const UV_VERSION_SUFFIX = ""; pub const UV_VERSION_HEX = ((UV_VERSION_MAJOR << @as(c_int, 16)) | (UV_VERSION_MINOR << @as(c_int, 8))) | UV_VERSION_PATCH; pub const UV_THREADPOOL_H_ = ""; @@ -2981,7 +2981,7 @@ fn StreamMixin(comptime Type: type) type { req.readStop(); error_cb(context_data, ReturnCodeI64.init(nreads).errEnum() orelse bun.sys.E.CANCELED); } else { - read_cb(context_data, buffer.slice()); + read_cb(context_data, buffer.base[0..@intCast(nreads)]); } } }; diff --git a/test/js/bun/spawn/spawn.test.ts b/test/js/bun/spawn/spawn.test.ts index 7cf2780fc7..e611f2b924 100644 --- a/test/js/bun/spawn/spawn.test.ts +++ b/test/js/bun/spawn/spawn.test.ts @@ -448,7 +448,7 @@ for (let [gcTick, label] of [ for (const [callback, fixture] of fixtures) { describe(fixture.slice(0, 12), () => { - describe("should should allow reading stdout", () => { + describe("should allow reading stdout", () => { it("before exit", async () => { const process = callback(); const output = await process.stdout.text();