Skip to content

Commit

Permalink
v1.0.2 Remove ChildProcess Heap
Browse files Browse the repository at this point in the history
  • Loading branch information
Epikest committed Jun 29, 2022
1 parent 144f61c commit 32e685a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/$.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const std = @import("std");
const shell = @import("build_options").shell;
const string = []const u8;

pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
Expand All @@ -9,8 +8,8 @@ pub fn main() !void {

var iterator = try std.process.argsWithAllocator(allocator);
defer iterator.deinit();

_ = iterator.skip(); // Skip the program name

var command: []const u8 = "";
var arena = std.heap.ArenaAllocator.init(allocator);
defer arena.deinit();
Expand All @@ -29,11 +28,8 @@ pub fn main() !void {
std.log.err("Failed to allocate the string", .{});
return;
};
var process = std.ChildProcess.init(&.{ "wsl", "-e", shell, "-li", "-c", command }, allocator) catch {
std.log.err("Failed to start child process", .{});
return;
};
defer process.deinit();

var process = std.ChildProcess.init(&.{ "wsl", "-e", shell, "-li", "-c", command }, allocator);
_ = process.spawnAndWait() catch {
std.log.err("Failed to spawn the child process", .{});
return;
Expand Down

0 comments on commit 32e685a

Please sign in to comment.