mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-26 13:01:34 +03:00
process.Child: use std.posix.SIG instead of u32 for Child.Term stopped field
This commit is contained in:
@@ -292,7 +292,7 @@ fn termToInteresting(term: std.process.Child.Term) Interestingness {
|
||||
return .boring;
|
||||
},
|
||||
.stopped => |sig| {
|
||||
std.debug.print("interestingness check stopped with signal {d}\n", .{sig});
|
||||
std.debug.print("interestingness check stopped with signal {t}\n", .{sig});
|
||||
return .boring;
|
||||
},
|
||||
.unknown => {
|
||||
|
||||
@@ -425,7 +425,7 @@ fn buildWasmBinary(
|
||||
},
|
||||
.stopped => |sig| {
|
||||
std.log.err(
|
||||
"the following command stopped unexpectedly with signal {d}:\n{s}",
|
||||
"the following command stopped unexpectedly with signal {t}:\n{s}",
|
||||
.{ sig, try std.Build.Step.allocPrintCmd(arena, .inherit, null, argv.items) },
|
||||
);
|
||||
return error.WasmCompilationFailed;
|
||||
|
||||
+2
-2
@@ -1899,11 +1899,11 @@ pub fn runAllowFail(
|
||||
}
|
||||
return stdout;
|
||||
},
|
||||
.signal => |sig| {
|
||||
.signal, .stopped => |sig| {
|
||||
out_code.* = @as(u8, @truncate(@intFromEnum(sig)));
|
||||
return error.ProcessTerminated;
|
||||
},
|
||||
.stopped, .unknown => |code| {
|
||||
.unknown => |code| {
|
||||
out_code.* = @as(u8, @truncate(code));
|
||||
return error.ProcessTerminated;
|
||||
},
|
||||
|
||||
@@ -728,7 +728,7 @@ pub fn handleChildProcessTerm(s: *Step, term: std.process.Child.Term) error{ Mak
|
||||
return switch (term) {
|
||||
.exited => |code| if (code != 0) s.fail("process exited with error code {d}", .{code}),
|
||||
.signal => |sig| s.fail("process terminated with signal {t}", .{sig}),
|
||||
.stopped => |sig| s.fail("process stopped with signal {d}", .{sig}),
|
||||
.stopped => |sig| s.fail("process stopped with signal {t}", .{sig}),
|
||||
.unknown => s.fail("process terminated unexpectedly", .{}),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1173,7 +1173,7 @@ fn formatTerm(term: ?process.Child.Term, w: *std.Io.Writer) std.Io.Writer.Error!
|
||||
if (term) |t| switch (t) {
|
||||
.exited => |code| try w.print("exited with code {d}", .{code}),
|
||||
.signal => |sig| try w.print("terminated with signal {t}", .{sig}),
|
||||
.stopped => |sig| try w.print("stopped with signal {d}", .{sig}),
|
||||
.stopped => |sig| try w.print("stopped with signal {t}", .{sig}),
|
||||
.unknown => |code| try w.print("terminated for unknown reason with code {d}", .{code}),
|
||||
} else {
|
||||
try w.writeAll("exited with any code");
|
||||
@@ -2804,8 +2804,8 @@ fn hashStdIo(hh: *std.Build.Cache.HashHelper, stdio: StdIo) void {
|
||||
.expect_term => |term| {
|
||||
hh.add(@as(std.meta.Tag(process.Child.Term), term));
|
||||
switch (term) {
|
||||
inline .exited, .signal => |x| hh.add(x),
|
||||
.stopped, .unknown => |x| hh.add(x),
|
||||
inline .exited, .signal, .stopped => |x| hh.add(x),
|
||||
.unknown => |x| hh.add(x),
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@@ -683,7 +683,7 @@ fn buildClientWasm(ws: *WebServer, arena: Allocator, optimize: std.builtin.Optim
|
||||
},
|
||||
.stopped => |sig| {
|
||||
log.err(
|
||||
"the following command stopped unexpectedly with signal {d}:\n{s}",
|
||||
"the following command stopped unexpectedly with signal {t}:\n{s}",
|
||||
.{ sig, try Build.Step.allocPrintCmd(arena, .inherit, null, argv.items) },
|
||||
);
|
||||
return error.WasmCompilationFailed;
|
||||
|
||||
@@ -15273,7 +15273,7 @@ fn childWaitPosix(child: *process.Child) process.Child.WaitError!process.Child.T
|
||||
return switch (code) {
|
||||
.EXITED => .{ .exited = @truncate(status) },
|
||||
.KILLED, .DUMPED => .{ .signal = @enumFromInt(status) },
|
||||
.TRAPPED, .STOPPED => .{ .stopped = status },
|
||||
.TRAPPED, .STOPPED => .{ .stopped = @enumFromInt(status) },
|
||||
_, .CONTINUED => .{ .unknown = status },
|
||||
};
|
||||
},
|
||||
|
||||
@@ -4729,7 +4729,7 @@ fn childWait(userdata: ?*anyopaque, child: *process.Child) process.Child.WaitErr
|
||||
return switch (code) {
|
||||
.EXITED => .{ .exited = @truncate(status) },
|
||||
.KILLED, .DUMPED => .{ .signal = @enumFromInt(status) },
|
||||
.TRAPPED, .STOPPED => .{ .stopped = status },
|
||||
.TRAPPED, .STOPPED => .{ .stopped = @enumFromInt(status) },
|
||||
_, .CONTINUED => .{ .unknown = status },
|
||||
};
|
||||
},
|
||||
|
||||
+17
-17
@@ -3721,14 +3721,14 @@ pub const W = switch (native_os) {
|
||||
pub fn TERMSIG(x: u32) SIG {
|
||||
return @enumFromInt(status(x));
|
||||
}
|
||||
pub fn STOPSIG(x: u32) u32 {
|
||||
return x >> 8;
|
||||
pub fn STOPSIG(x: u32) SIG {
|
||||
return @enumFromInt(x >> 8);
|
||||
}
|
||||
pub fn IFEXITED(x: u32) bool {
|
||||
return status(x) == 0;
|
||||
}
|
||||
pub fn IFSTOPPED(x: u32) bool {
|
||||
return status(x) == stopped and STOPSIG(x) != 0x13;
|
||||
return status(x) == stopped and @as(u32, @intFromEnum(STOPSIG(x))) != 0x13;
|
||||
}
|
||||
pub fn IFSIGNALED(x: u32) bool {
|
||||
return status(x) != stopped and status(x) != 0;
|
||||
@@ -3754,8 +3754,8 @@ pub const W = switch (native_os) {
|
||||
pub fn TERMSIG(s: u32) SIG {
|
||||
return @enumFromInt(s & 0x7f);
|
||||
}
|
||||
pub fn STOPSIG(s: u32) u32 {
|
||||
return EXITSTATUS(s);
|
||||
pub fn STOPSIG(s: u32) SIG {
|
||||
return @enumFromInt(EXITSTATUS(s));
|
||||
}
|
||||
pub fn IFEXITED(s: u32) bool {
|
||||
return (s & 0x7f) == 0;
|
||||
@@ -3782,8 +3782,8 @@ pub const W = switch (native_os) {
|
||||
pub fn TERMSIG(s: u32) SIG {
|
||||
return @enumFromInt(s & 0x7f);
|
||||
}
|
||||
pub fn STOPSIG(s: u32) u32 {
|
||||
return EXITSTATUS(s);
|
||||
pub fn STOPSIG(s: u32) SIG {
|
||||
return @enumFromInt(EXITSTATUS(s));
|
||||
}
|
||||
pub fn IFEXITED(s: u32) bool {
|
||||
return (s & 0x7f) == 0;
|
||||
@@ -3816,8 +3816,8 @@ pub const W = switch (native_os) {
|
||||
pub fn TERMSIG(s: u32) SIG {
|
||||
return @enumFromInt(s & 0x7f);
|
||||
}
|
||||
pub fn STOPSIG(s: u32) u32 {
|
||||
return EXITSTATUS(s);
|
||||
pub fn STOPSIG(s: u32) SIG {
|
||||
return @enumFromInt(EXITSTATUS(s));
|
||||
}
|
||||
pub fn IFEXITED(s: u32) bool {
|
||||
return (s & 0x7f) == 0;
|
||||
@@ -3850,8 +3850,8 @@ pub const W = switch (native_os) {
|
||||
pub fn TERMSIG(s: u32) SIG {
|
||||
return @enumFromInt(s & 0x7f);
|
||||
}
|
||||
pub fn STOPSIG(s: u32) u32 {
|
||||
return EXITSTATUS(s);
|
||||
pub fn STOPSIG(s: u32) SIG {
|
||||
return @enumFromInt(EXITSTATUS(s));
|
||||
}
|
||||
pub fn IFEXITED(s: u32) bool {
|
||||
return (s & 0x7f) == 0;
|
||||
@@ -3879,8 +3879,8 @@ pub const W = switch (native_os) {
|
||||
return @enumFromInt((s >> 8) & 0xff);
|
||||
}
|
||||
|
||||
pub fn STOPSIG(s: u32) u32 {
|
||||
return (s >> 16) & 0xff;
|
||||
pub fn STOPSIG(s: u32) SIG {
|
||||
return @enumFromInt((s >> 16) & 0xff);
|
||||
}
|
||||
|
||||
pub fn IFEXITED(s: u32) bool {
|
||||
@@ -3906,8 +3906,8 @@ pub const W = switch (native_os) {
|
||||
pub fn TERMSIG(s: u32) SIG {
|
||||
return @enumFromInt(s & 0x7f);
|
||||
}
|
||||
pub fn STOPSIG(s: u32) u32 {
|
||||
return EXITSTATUS(s);
|
||||
pub fn STOPSIG(s: u32) SIG {
|
||||
return @enumFromInt(EXITSTATUS(s));
|
||||
}
|
||||
pub fn IFEXITED(s: u32) bool {
|
||||
return (s & 0x7f) == 0;
|
||||
@@ -3938,8 +3938,8 @@ pub const W = switch (native_os) {
|
||||
return @intCast((s & 0xff00) >> 8);
|
||||
}
|
||||
|
||||
pub fn STOPSIG(s: u32) u32 {
|
||||
return EXITSTATUS(s);
|
||||
pub fn STOPSIG(s: u32) SIG {
|
||||
return @enumFromInt(EXITSTATUS(s));
|
||||
}
|
||||
|
||||
pub fn TERMSIG(s: u32) SIG {
|
||||
|
||||
@@ -228,7 +228,7 @@ pub const W = struct {
|
||||
return @enumFromInt(s & 0x7f);
|
||||
}
|
||||
pub fn STOPSIG(s: u32) u32 {
|
||||
return EXITSTATUS(s);
|
||||
return @enumFromInt(EXITSTATUS(s));
|
||||
}
|
||||
pub fn IFEXITED(s: u32) bool {
|
||||
return (s & 0x7f) == 0;
|
||||
|
||||
@@ -3883,8 +3883,8 @@ pub const W = struct {
|
||||
pub fn TERMSIG(s: u32) SIG {
|
||||
return @enumFromInt(s & 0x7f);
|
||||
}
|
||||
pub fn STOPSIG(s: u32) u32 {
|
||||
return EXITSTATUS(s);
|
||||
pub fn STOPSIG(s: u32) SIG {
|
||||
return @enumFromInt(EXITSTATUS(s));
|
||||
}
|
||||
pub fn IFEXITED(s: u32) bool {
|
||||
return (s & 0x7f) == 0;
|
||||
|
||||
@@ -94,7 +94,7 @@ pub const ResourceUsageStatistics = struct {
|
||||
pub const Term = union(enum) {
|
||||
exited: u8,
|
||||
signal: std.posix.SIG,
|
||||
stopped: u32,
|
||||
stopped: std.posix.SIG,
|
||||
unknown: u32,
|
||||
};
|
||||
|
||||
|
||||
@@ -1195,7 +1195,7 @@ fn detectAndroidApiLevel(io: Io) !u32 {
|
||||
return error.ApiLevelQueryFailed;
|
||||
},
|
||||
.stopped => |sig| {
|
||||
std.log.err("getprop stopped abnormally with signal: {d}", .{sig});
|
||||
std.log.err("getprop stopped abnormally with signal: {t}", .{sig});
|
||||
return error.ApiLevelQueryFailed;
|
||||
},
|
||||
.unknown => {
|
||||
|
||||
+2
-2
@@ -5872,7 +5872,7 @@ fn updateCObject(comp: *Compilation, c_object: *CObject, c_obj_prog_node: std.Pr
|
||||
},
|
||||
.stopped => |sig| {
|
||||
log.err("clang failed with stderr: {s}", .{stderr});
|
||||
return comp.failCObj(c_object, "clang stopped with signal {d}", .{sig});
|
||||
return comp.failCObj(c_object, "clang stopped with signal {t}", .{sig});
|
||||
},
|
||||
.unknown => {
|
||||
log.err("clang terminated with stderr: {s}", .{stderr});
|
||||
@@ -6302,7 +6302,7 @@ fn spawnZigRc(
|
||||
return comp.failWin32Resource(win32_resource, "zig rc terminated unexpectedly", .{});
|
||||
},
|
||||
.stopped => |sig| {
|
||||
log.err("zig rc stopped {d} with stderr:\n{s}", .{ sig, stderr });
|
||||
log.err("zig rc stopped {t} with stderr:\n{s}", .{ sig, stderr });
|
||||
return comp.failWin32Resource(win32_resource, "zig rc terminated unexpectedly", .{});
|
||||
},
|
||||
.unknown => {
|
||||
|
||||
+1
-1
@@ -1733,7 +1733,7 @@ fn spawnLld(comp: *Compilation, arena: Allocator, argv: []const []const u8) !voi
|
||||
},
|
||||
.stopped => |sig| {
|
||||
if (comp.clang_passthrough_mode) std.process.abort();
|
||||
return diags.fail("{s} stopped with signal {d} and stderr:\n{s}", .{ argv[0], sig, stderr });
|
||||
return diags.fail("{s} stopped with signal {t} and stderr:\n{s}", .{ argv[0], sig, stderr });
|
||||
},
|
||||
.unknown => |code| {
|
||||
if (comp.clang_passthrough_mode) std.process.abort();
|
||||
|
||||
+3
-3
@@ -4582,7 +4582,7 @@ fn runOrTest(
|
||||
},
|
||||
.stopped => |sig| {
|
||||
const cmd = try std.mem.join(arena, " ", argv.items);
|
||||
fatal("the following command stopped with signal {d}:\n{s}", .{ sig, cmd });
|
||||
fatal("the following command stopped with signal {t}:\n{s}", .{ sig, cmd });
|
||||
},
|
||||
.unknown => {
|
||||
process.exit(1);
|
||||
@@ -5637,7 +5637,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, io: Io, args: []const []const u8,
|
||||
},
|
||||
.stopped => |sig| {
|
||||
const cmd = try std.mem.join(arena, " ", child_argv.items);
|
||||
fatal("the following build command stopped with signal {d}:\n{s}", .{ sig, cmd });
|
||||
fatal("the following build command stopped with signal {t}:\n{s}", .{ sig, cmd });
|
||||
},
|
||||
.unknown => {
|
||||
const cmd = try std.mem.join(arena, " ", child_argv.items);
|
||||
@@ -5943,7 +5943,7 @@ fn jitCmdInner(
|
||||
},
|
||||
.stopped => |sig| {
|
||||
const cmd = try std.mem.join(arena, " ", child_argv.items);
|
||||
fatal("the following build command stopped with signal {d}:\n{s}", .{ sig, cmd });
|
||||
fatal("the following build command stopped with signal {t}:\n{s}", .{ sig, cmd });
|
||||
},
|
||||
.unknown => {
|
||||
const cmd = try std.mem.join(arena, " ", child_argv.items);
|
||||
|
||||
+1
-1
@@ -1142,7 +1142,7 @@ fn run(
|
||||
return error.ChildCrashed;
|
||||
},
|
||||
.stopped => |sig| {
|
||||
std.debug.print("{s}\nThe following command stopped with signal {d}:\n", .{ result.stderr, sig });
|
||||
std.debug.print("{s}\nThe following command stopped with signal {t}:\n", .{ result.stderr, sig });
|
||||
dumpArgs(args);
|
||||
return error.ChildCrashed;
|
||||
},
|
||||
|
||||
@@ -569,7 +569,7 @@ const Eval = struct {
|
||||
eval.fatal("generated executable '{s}' terminated with signal {t}", .{ binary_path, sig });
|
||||
},
|
||||
.stopped => |sig| {
|
||||
eval.fatal("generated executable '{s}' stopped with signal {d}", .{ binary_path, sig });
|
||||
eval.fatal("generated executable '{s}' stopped with signal {t}", .{ binary_path, sig });
|
||||
},
|
||||
.unknown => {
|
||||
eval.fatal("generated executable '{s}' terminated unexpectedly", .{binary_path});
|
||||
@@ -639,7 +639,7 @@ const Eval = struct {
|
||||
switch (result.term) {
|
||||
.exited => |code| eval.fatal("zig cc for '{s}' failed with code {d}", .{ c_path, code }),
|
||||
.signal => |sig| eval.fatal("zig cc for '{s}' terminated unexpectedly with signal {t}", .{ c_path, sig }),
|
||||
.stopped => |sig| eval.fatal("zig cc for '{s}' stopped unexpectedly with signal {d}", .{ c_path, sig }),
|
||||
.stopped => |sig| eval.fatal("zig cc for '{s}' stopped unexpectedly with signal {t}", .{ c_path, sig }),
|
||||
.unknown => eval.fatal("zig cc for '{s}' terminated unexpectedly", .{c_path}),
|
||||
}
|
||||
}
|
||||
@@ -919,7 +919,7 @@ fn waitChild(child: *std.process.Child, eval: *Eval) void {
|
||||
switch (term) {
|
||||
.exited => |code| if (code != 0) eval.fatal("compiler failed with code {d}", .{code}),
|
||||
.signal => |sig| eval.fatal("compiler terminated with signal {t}", .{sig}),
|
||||
.stopped => |sig| eval.fatal("compiler stopped unexpectedly with signal {d}", .{sig}),
|
||||
.stopped => |sig| eval.fatal("compiler stopped unexpectedly with signal {t}", .{sig}),
|
||||
.unknown => eval.fatal("compiler terminated unexpectedly", .{}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -699,7 +699,6 @@ pub fn main(init: std.process.Init) !void {
|
||||
.unknown => {
|
||||
fatal("llvm-tblgen crashed\n", .{});
|
||||
},
|
||||
else => fatal("llvm-tblgen crashed", .{}),
|
||||
};
|
||||
|
||||
const parsed = try json.parseFromSlice(json.Value, arena, json_text, .{});
|
||||
|
||||
@@ -2017,7 +2017,7 @@ fn processOneTarget(io: Io, job: Job) void {
|
||||
std.process.exit(1);
|
||||
},
|
||||
.stopped => |sig| {
|
||||
std.debug.print("llvm-tblgen stopped with signal {d}\n", .{sig});
|
||||
std.debug.print("llvm-tblgen stopped with signal {t}\n", .{sig});
|
||||
std.process.exit(1);
|
||||
},
|
||||
.unknown => {
|
||||
|
||||
Reference in New Issue
Block a user