From e1d1683c3f6c0ac5862aca0fd732c701a5e687f7 Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Sat, 21 Mar 2020 02:34:59 +0100 Subject: [PATCH] Spawn a child --- build.zig | 5 +++-- src/main.zig | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/build.zig b/build.zig index 423487d..48eb612 100644 --- a/build.zig +++ b/build.zig @@ -14,12 +14,13 @@ pub fn build(b: *Builder) void { const exe = b.addExecutable("zag", "src/main.zig"); exe.setTarget(target); exe.setBuildMode(mode); + exe.addIncludeDir("protocol"); exe.linkLibC(); - exe.linkSystemLibrary("pixman"); + exe.addIncludeDir("/usr/include/pixman-1"); + //exe.linkSystemLibrary("pixman"); exe.linkSystemLibrary("wayland-server"); exe.linkSystemLibrary("wlroots"); exe.linkSystemLibrary("xkbcommon"); - exe.addIncludeDir("protocol"); exe.install(); const run_cmd = exe.run(); diff --git a/src/main.zig b/src/main.zig index c9073af..0b7eac2 100644 --- a/src/main.zig +++ b/src/main.zig @@ -566,9 +566,14 @@ pub fn main() !void { if (c.setenv("WAYLAND_DISPLAY", socket, 1) == -1) { return ZagError.CantSetEnv; } + + const argv = [_][]const u8{ "/bin/sh", "-c", "alacritty" }; + var child = try std.ChildProcess.init(&argv, std.heap.c_allocator); + try std.ChildProcess.spawn(child); //if (startup_cmd) { //if (std.os.linux.fork() == 0) { - //execl("/bin/sh", "/bin/sh", "-c", startup_cmd, (void *)NULL); + // execl("/bin/sh", "/bin/sh", "-c", startup_cmd, (void *)NULL); + // std.os.linux.execve("/bin/sh", //} //}