authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-03-12 00:34:11-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-03-15 10:48:14-07:00
log98299e7787146e1572cd2038654dbbcf84fa32d1
tree9a21480792cc5009b3587d58b571900330c3ed66
parent53fb59ea9b148a9d1f694039898eb60a1df75535

add std.process.cleanExit


1 files changed, 13 insertions(+), 0 deletions(-)

lib/std/process.zig+13
......@@ -1204,3 +1204,16 @@ fn totalSystemMemoryLinux() !usize {
12041204 const kilobytes = try std.fmt.parseInt(usize, int_text, 10);
12051205 return kilobytes * 1024;
12061206}
1207
1208/// Indicate that we are now terminating with a successful exit code.
1209/// In debug builds, this is a no-op, so that the calling code's
1210/// cleanup mechanisms are tested and so that external tools that
1211/// check for resource leaks can be accurate. In release builds, this
1212/// calls exit(0), and does not return.
1213pub fn cleanExit() void {
1214 if (builtin.mode == .Debug) {
1215 return;
1216 } else {
1217 exit(0);
1218 }
1219}