mirror of
https://github.com/oven-sh/bun
synced 2026-02-14 04:49:06 +00:00
workaround build errors
This commit is contained in:
@@ -173,7 +173,7 @@ pub const FilePoll = struct {
|
||||
};
|
||||
|
||||
const LifecycleScriptSubprocessOutputReader = bun.install.LifecycleScriptSubprocess.OutputReader;
|
||||
|
||||
const BufferedReader = bun.io.BufferedReader;
|
||||
pub const Owner = bun.TaggedPointerUnion(.{
|
||||
FileSink,
|
||||
|
||||
@@ -344,25 +344,25 @@ pub const FilePoll = struct {
|
||||
// var loader = ptr.as(ShellSubprocessCapturedBufferedWriterMini);
|
||||
// loader.onPoll(size_or_offset, 0);
|
||||
// },
|
||||
@field(Owner.Tag, bun.meta.typeBase(@typeName(StaticPipeWriter))) => {
|
||||
@field(Owner.Tag, bun.meta.typeBaseName(@typeName(StaticPipeWriter))) => {
|
||||
var handler: *StaticPipeWriter = ptr.as(StaticPipeWriter);
|
||||
handler.onPoll(size_or_offset);
|
||||
},
|
||||
@field(Owner.Tag, bun.meta.typeBase(@typeName(FileSink))) => {
|
||||
@field(Owner.Tag, bun.meta.typeBaseName(@typeName(FileSink))) => {
|
||||
var handler: *FileSink = ptr.as(FileSink);
|
||||
handler.onPoll(size_or_offset);
|
||||
},
|
||||
@field(Owner.Tag, bun.meta.typeBaseName(@typeName(BufferedReader))) => {
|
||||
log("onUpdate " ++ kqueue_or_epoll ++ " (fd: {d}) Reader", .{poll.fd});
|
||||
var handler: *BufferedReader = ptr.as(BufferedReader);
|
||||
handler.onPoll(size_or_offset);
|
||||
},
|
||||
@field(Owner.Tag, bun.meta.typeBaseName(@typeName(Process))) => {
|
||||
log("onUpdate " ++ kqueue_or_epoll ++ " (fd: {d}) Process", .{poll.fd});
|
||||
var loader = ptr.as(Process);
|
||||
|
||||
loader.onWaitPidFromEventLoopTask();
|
||||
},
|
||||
@field(Owner.Tag, bun.meta.typeBaseName(@typeName(JSC.WebCore.FileSink))) => {
|
||||
log("onUpdate " ++ kqueue_or_epoll ++ " (fd: {d}) FileSink", .{poll.fd});
|
||||
var loader = ptr.as(JSC.WebCore.FileSink);
|
||||
loader.onPoll(size_or_offset, 0);
|
||||
},
|
||||
|
||||
@field(Owner.Tag, "DNSResolver") => {
|
||||
log("onUpdate " ++ kqueue_or_epoll ++ " (fd: {d}) DNSResolver", .{poll.fd});
|
||||
@@ -380,12 +380,6 @@ pub const FilePoll = struct {
|
||||
loader.onMachportChange();
|
||||
},
|
||||
|
||||
@field(Owner.Tag, bun.meta.typeBaseName(@typeName(LifecycleScriptSubprocessOutputReader))) => {
|
||||
log("onUpdate " ++ kqueue_or_epoll ++ " (fd: {d}) OutputReader", .{poll.fd});
|
||||
var output: *LifecycleScriptSubprocessOutputReader = ptr.as(LifecycleScriptSubprocessOutputReader);
|
||||
output.onPoll(size_or_offset);
|
||||
},
|
||||
|
||||
else => {
|
||||
const possible_name = Owner.typeNameFromTag(@intFromEnum(ptr.tag()));
|
||||
log("onUpdate " ++ kqueue_or_epoll ++ " (fd: {d}) disconnected? (maybe: {s})", .{ poll.fd, possible_name orelse "<unknown>" });
|
||||
|
||||
@@ -714,7 +714,7 @@ pub const Subprocess = struct {
|
||||
}
|
||||
|
||||
pub fn loop(this: *This) *uws.Loop {
|
||||
return this.event_loop.virtual_machine.uwsLoop();
|
||||
return this.event_loop.loop();
|
||||
}
|
||||
|
||||
pub fn eventLoop(this: *This) JSC.EventLoopHandle {
|
||||
@@ -802,10 +802,10 @@ pub const Subprocess = struct {
|
||||
return this.state.done;
|
||||
}
|
||||
// we do not use .toOwnedSlice() because we don't want to reallocate memory.
|
||||
const out = this.reader.buffer.items;
|
||||
this.reader.buffer.items = &.{};
|
||||
this.reader.buffer.capacity = 0;
|
||||
return out;
|
||||
const out = this.reader._buffer;
|
||||
this.reader._buffer.items = &.{};
|
||||
this.reader._buffer.capacity = 0;
|
||||
return out.items;
|
||||
}
|
||||
|
||||
pub fn setFd(this: *PipeReader, fd: bun.FileDescriptor) *PipeReader {
|
||||
@@ -858,7 +858,7 @@ pub const Subprocess = struct {
|
||||
}
|
||||
this.state = .{ .err = err };
|
||||
if (this.process) |process|
|
||||
process.onCloseIO(this.kind());
|
||||
process.onCloseIO(this.kind(process));
|
||||
}
|
||||
|
||||
pub fn close(this: *PipeReader) void {
|
||||
@@ -1005,7 +1005,7 @@ pub const Subprocess = struct {
|
||||
return switch (this.*) {
|
||||
.fd => |fd| JSValue.jsNumber(fd),
|
||||
.memfd, .ignore => JSValue.jsUndefined(),
|
||||
.capture, .buffer, .inherit => JSValue.jsUndefined(),
|
||||
.buffer, .inherit => JSValue.jsUndefined(),
|
||||
.pipe => |pipe| {
|
||||
this.* = .{ .ignore = {} };
|
||||
return pipe.toJS(globalThis);
|
||||
|
||||
@@ -2767,7 +2767,7 @@ pub const FileSink = struct {
|
||||
log("onWrite({d}, {any})", .{ amount, done });
|
||||
this.written += amount;
|
||||
if (this.pending.state == .pending)
|
||||
this.pending.consumed += amount;
|
||||
this.pending.consumed += @truncate(amount);
|
||||
|
||||
if (done) {
|
||||
if (this.pending.state == .pending) {
|
||||
|
||||
@@ -191,7 +191,7 @@ pub fn PosixBufferedWriter(
|
||||
var poll = this.getPoll() orelse return;
|
||||
switch (poll.registerWithFd(bun.uws.Loop.get(), .writable, true, poll.fd)) {
|
||||
.err => |err| {
|
||||
onError(this, err);
|
||||
onError(this.parent, err);
|
||||
},
|
||||
.result => {},
|
||||
}
|
||||
@@ -247,11 +247,11 @@ pub fn PosixBufferedWriter(
|
||||
this.handle = .{ .fd = fd };
|
||||
return JSC.Maybe(void){ .result = {} };
|
||||
}
|
||||
const loop = @as(*Parent, @ptrCast(this.parent)).loop();
|
||||
var poll = this.getPoll() orelse brk: {
|
||||
this.handle = .{ .poll = Async.FilePoll.init(loop, fd, .{}, PosixWriter, this) };
|
||||
this.handle = .{ .poll = Async.FilePoll.init(@as(*Parent, @ptrCast(this.parent)).eventLoop(), fd, .{}, PosixWriter, this) };
|
||||
break :brk this.handle.poll;
|
||||
};
|
||||
const loop = @as(*Parent, @ptrCast(this.parent)).eventLoop().loop();
|
||||
|
||||
switch (poll.registerWithFd(loop, .writable, true, fd)) {
|
||||
.err => |err| {
|
||||
|
||||
@@ -1472,6 +1472,9 @@ pub fn NewInterpreter(comptime EventLoopKind: JSC.EventLoopKind) type {
|
||||
}
|
||||
|
||||
pub fn start(this: *Expansion) void {
|
||||
if (comptime true) {
|
||||
@panic("TODO SHELL");
|
||||
}
|
||||
if (comptime bun.Environment.allow_assert) {
|
||||
std.debug.assert(this.child_state == .idle);
|
||||
std.debug.assert(this.word_idx == 0);
|
||||
@@ -3200,6 +3203,9 @@ pub fn NewInterpreter(comptime EventLoopKind: JSC.EventLoopKind) type {
|
||||
}
|
||||
|
||||
fn initSubproc(this: *Cmd) void {
|
||||
if (comptime true) {
|
||||
@panic("SHELL TODO");
|
||||
}
|
||||
log("cmd init subproc ({x}, cwd={s})", .{ @intFromPtr(this), this.base.shell.cwd() });
|
||||
|
||||
var arena = &this.spawn_arena;
|
||||
@@ -3767,6 +3773,10 @@ pub fn NewInterpreter(comptime EventLoopKind: JSC.EventLoopKind) type {
|
||||
}
|
||||
|
||||
fn callImplWithType(this: *Builtin, comptime Impl: type, comptime Ret: type, comptime union_field: []const u8, comptime field: []const u8, args_: anytype) Ret {
|
||||
if (comptime true) {
|
||||
@panic("TODO SHELL");
|
||||
}
|
||||
|
||||
const self = &@field(this.impl, union_field);
|
||||
const args = brk: {
|
||||
var args: std.meta.ArgsTuple(@TypeOf(@field(Impl, field))) = undefined;
|
||||
@@ -7288,6 +7298,8 @@ pub fn NewInterpreter(comptime EventLoopKind: JSC.EventLoopKind) type {
|
||||
pub const BufferedWriter =
|
||||
struct {
|
||||
writer: Writer = .{},
|
||||
fd: bun.FileDescriptor = bun.invalid_fd,
|
||||
remain: []const u8 = "",
|
||||
written: usize = 0,
|
||||
parent: ParentPtr,
|
||||
err: ?Syscall.Error = null,
|
||||
@@ -7302,6 +7314,13 @@ pub fn NewInterpreter(comptime EventLoopKind: JSC.EventLoopKind) type {
|
||||
const BuiltinJs = bun.shell.Interpreter.Builtin;
|
||||
const BuiltinMini = bun.shell.InterpreterMini.Builtin;
|
||||
|
||||
pub fn write(this: *@This()) void {
|
||||
_ = this; // autofix
|
||||
if (comptime true) {
|
||||
@panic("TODO SHELL");
|
||||
}
|
||||
}
|
||||
|
||||
pub const Writer = bun.io.BufferedWriter(
|
||||
@This(),
|
||||
onWrite,
|
||||
@@ -7438,6 +7457,10 @@ pub fn StatePtrUnion(comptime TypesValue: anytype) type {
|
||||
}
|
||||
|
||||
pub fn start(this: @This()) void {
|
||||
if (comptime true) {
|
||||
@panic("TODO SHELL");
|
||||
}
|
||||
|
||||
const tags = comptime std.meta.fields(Ptr.Tag);
|
||||
inline for (tags) |tag| {
|
||||
if (this.tagInt() == tag.value) {
|
||||
@@ -7451,6 +7474,10 @@ pub fn StatePtrUnion(comptime TypesValue: anytype) type {
|
||||
}
|
||||
|
||||
pub fn deinit(this: @This()) void {
|
||||
if (comptime true) {
|
||||
@panic("TODO SHELL");
|
||||
}
|
||||
|
||||
const tags = comptime std.meta.fields(Ptr.Tag);
|
||||
inline for (tags) |tag| {
|
||||
if (this.tagInt() == tag.value) {
|
||||
@@ -7467,6 +7494,10 @@ pub fn StatePtrUnion(comptime TypesValue: anytype) type {
|
||||
}
|
||||
|
||||
pub fn childDone(this: @This(), child: anytype, exit_code: ExitCode) void {
|
||||
if (comptime true) {
|
||||
@panic("TODO SHELL");
|
||||
}
|
||||
|
||||
const tags = comptime std.meta.fields(Ptr.Tag);
|
||||
inline for (tags) |tag| {
|
||||
if (this.tagInt() == tag.value) {
|
||||
|
||||
Reference in New Issue
Block a user