Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,11 @@ pub fn main() !void {

defer allocator.free(zig_binary);

try exec(allocator, zig_binary, args);
const term = try exec(allocator, zig_binary, args);
std.os.exit(term.Exited);
}

fn exec(allocator: std.mem.Allocator, zig_binary: []const u8, args: [][:0]u8) !void {
fn exec(allocator: std.mem.Allocator, zig_binary: []const u8, args: [][:0]u8) !std.ChildProcess.Term {
var nargs = std.ArrayList([]const u8).init(allocator);
defer nargs.deinit();
try nargs.append(zig_binary);
Expand All @@ -109,7 +110,7 @@ fn exec(allocator: std.mem.Allocator, zig_binary: []const u8, args: [][:0]u8) !v

var naargs = try nargs.toOwnedSlice();
defer allocator.free(naargs);
_ = try run(allocator, naargs);
return try run(allocator, naargs);
}

// if user is in /home/john/dummy/x and there is a entry for /home/john/dummy/ in the config file,
Expand Down
5 changes: 2 additions & 3 deletions src/utils.zig
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
const std = @import("std");

pub fn run(allocator: std.mem.Allocator, argv: []const []const u8) !void {
pub fn run(allocator: std.mem.Allocator, argv: []const []const u8) !std.ChildProcess.Term {
var proc = std.ChildProcess.init(argv, allocator);
try proc.spawn();
_ = try proc.wait();
return proc.spawnAndWait();
}

pub fn fromHome(home: []const u8, to: []const u8) !std.fs.Dir {
Expand Down
1 change: 0 additions & 1 deletion zigd.ver

This file was deleted.