diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-07-19 17:38:15 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-07-20 01:06:28 -0700 |
| commit | 9d00f69be58e7b807e26ba8a38050dd486d487f4 (patch) | |
| tree | cd3f0601527f3884df3f21dbe8b18c4bbea73a76 /lib | |
| parent | 4f742c4cfc3c3134a0d6ebfdfc354286ae97b2c1 (diff) | |
| download | zig-9d00f69be58e7b807e26ba8a38050dd486d487f4.tar.gz zig-9d00f69be58e7b807e26ba8a38050dd486d487f4.zip | |
move std.zig.fatal to std.process.fatal
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/std/process.zig | 6 | ||||
| -rw-r--r-- | lib/std/zig.zig | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/std/process.zig b/lib/std/process.zig index 86654e4b5a..eca3a26c29 100644 --- a/lib/std/process.zig +++ b/lib/std/process.zig @@ -2032,3 +2032,9 @@ pub fn createWindowsEnvBlock(allocator: mem.Allocator, env_map: *const EnvMap) ! i += 1; return try allocator.realloc(result, i); } + +/// Logs an error and then terminates the process with exit code 1. +pub fn fatal(comptime format: []const u8, format_arguments: anytype) noreturn { + std.log.err(format, format_arguments); + exit(1); +} diff --git a/lib/std/zig.zig b/lib/std/zig.zig index 230dc45ddc..01d3aafa75 100644 --- a/lib/std/zig.zig +++ b/lib/std/zig.zig @@ -667,10 +667,8 @@ pub fn parseTargetQueryOrReportFatalError( }; } -pub fn fatal(comptime format: []const u8, args: anytype) noreturn { - std.log.err(format, args); - std.process.exit(1); -} +/// Deprecated; see `std.process.fatal`. +pub const fatal = std.process.fatal; /// Collects all the environment variables that Zig could possibly inspect, so /// that we can do reflection on this and print them with `zig env`. |
