Spawn a child

This commit is contained in:
Isaac Freund 2020-03-21 02:34:59 +01:00
parent 5ca93a57ba
commit e1d1683c3f
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11
2 changed files with 9 additions and 3 deletions

View File

@ -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();

View File

@ -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",
//}
//}