mirror of
https://github.com/oven-sh/bun
synced 2026-02-14 12:51:54 +00:00
Inching closer
This commit is contained in:
@@ -862,7 +862,7 @@ pub const Subprocess = struct {
|
||||
|
||||
switch (this.state) {
|
||||
.pending => {
|
||||
const stream = JSC.WebCore.ReadableStream.fromPipe(globalObject, &this.reader);
|
||||
const stream = JSC.WebCore.ReadableStream.fromPipe(globalObject, this, &this.reader);
|
||||
this.state = .{ .done = &.{} };
|
||||
return stream;
|
||||
},
|
||||
|
||||
@@ -360,6 +360,7 @@ pub const ReadableStream = struct {
|
||||
|
||||
pub fn fromPipe(
|
||||
globalThis: *JSGlobalObject,
|
||||
parent: anytype,
|
||||
buffered_reader: anytype,
|
||||
) JSC.JSValue {
|
||||
JSC.markBinding(@src());
|
||||
@@ -371,6 +372,11 @@ pub const ReadableStream = struct {
|
||||
});
|
||||
source.context.reader.from(buffered_reader, &source.context);
|
||||
|
||||
if (comptime Environment.isPosix) {
|
||||
source.context.fd = parent.fd;
|
||||
parent.fd = bun.invalid_fd;
|
||||
}
|
||||
|
||||
return source.toJS(globalThis);
|
||||
}
|
||||
|
||||
|
||||
@@ -544,7 +544,8 @@ const PosixBufferedReader = struct {
|
||||
pub fn registerPoll(this: *PosixBufferedReader) void {
|
||||
const poll = this.handle.getPoll() orelse brk: {
|
||||
if (this.handle == .fd and this.pollable) {
|
||||
break :brk Async.FilePoll.init(this.eventLoop(), this.getFd(), .{}, @This(), this);
|
||||
this.handle = .{ .poll = Async.FilePoll.init(this.eventLoop(), this.getFd(), .{}, @This(), this) };
|
||||
break :brk this.handle.poll;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user