zig libc: fix subcommand

This branch regressed the child process "run" mechanism because it
didn't pass the correct stdin, stdout, stderr values to process.spawn

Fixed now.
This commit is contained in:
Andrew Kelley 2026-01-01 20:20:58 -08:00
parent 960c512efd
commit f28802a9c6
23 changed files with 167 additions and 199 deletions

View file

@ -28,21 +28,13 @@ const usage =
\\
;
pub fn main() !void {
var arena_instance = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena_instance.deinit();
pub fn main(init: std.process.Init) !void {
const arena = init.arena.allocator();
const io = init.io;
const arena = arena_instance.allocator();
var args_it = try process.argsWithAllocator(arena);
var args_it = try init.minimal.args.iterateAllocator(arena);
if (!args_it.skip()) @panic("expected self arg");
const gpa = arena;
var threaded: std.Io.Threaded = .init(gpa, .{});
defer threaded.deinit();
const io = threaded.io();
var opt_code_dir: ?[]const u8 = null;
var opt_input: ?[]const u8 = null;
var opt_output: ?[]const u8 = null;

View file

@ -29,21 +29,13 @@ const usage =
\\
;
pub fn main() !void {
var arena_instance = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena_instance.deinit();
pub fn main(init: std.process.Init) !void {
const arena = init.arena.allocator();
const io = init.io;
const arena = arena_instance.allocator();
var args_it = try process.argsWithAllocator(arena);
var args_it = try init.minimal.args.iterateAllocator(arena);
if (!args_it.skip()) fatal("missing argv[0]", .{});
const gpa = arena;
var threaded: std.Io.Threaded = .init(gpa, .{});
defer threaded.deinit();
const io = threaded.io();
var opt_input: ?[]const u8 = null;
var opt_output: ?[]const u8 = null;
var opt_zig: ?[]const u8 = null;

View file

@ -44,7 +44,7 @@ pub fn main(init: std.process.Init) !void {
var debug_log_args: std.ArrayList([]const u8) = .empty;
var arg_it = try std.process.argsWithAllocator(arena);
var arg_it = try init.minimal.argsIterator(arena);
_ = arg_it.skip();
while (arg_it.next()) |arg| {
if (arg.len > 0 and arg[0] == '-') {

View file

@ -1883,20 +1883,11 @@ const targets = [_]ArchTarget{
},
};
pub fn main() anyerror!void {
var debug_allocator: std.heap.DebugAllocator(.{}) = .init;
defer _ = debug_allocator.deinit();
const gpa = debug_allocator.allocator();
pub fn main(init: std.process.Init) !void {
const arena = init.arena_allocator.allocator();
const io = init.io;
var arena_state: std.heap.ArenaAllocator = .init(gpa);
defer arena_state.deinit();
const arena = arena_state.allocator();
var threaded: std.Io.Threaded = .init(gpa, .{});
defer threaded.deinit();
const io = threaded.io();
var args = try std.process.argsWithAllocator(arena);
var args = try init.minimal.args.iterateAllocator(arena);
const args0 = args.next().?;
const llvm_tblgen_exe = args.next() orelse