wm

[root]/ src / util.zig

653B

raw
const std = @import("std");

pub fn die(comptime fmt: []const u8, args: anytype) noreturn {
    const stderr = std.io.getStdErr().writer();
    stderr.print(fmt, args) catch {};
    std.process.exit(1);
}

pub fn log(comptime fmt: []const u8, args: anytype) void {
    const stderr = std.io.getStdErr().writer();
    stderr.print(fmt, args) catch {};
}

pub fn spawn(alloc: std.mem.Allocator, cmd: []const [:0]const u8) void {
    if (cmd.len == 0) return;
    var child = std.process.Child.init(cmd, alloc);
    child.stdin_behavior = .Ignore;
    child.stdout_behavior = .Ignore;
    child.stderr_behavior = .Ignore;
    _ = child.spawn() catch {};
}