Compare commits
No commits in common. "6d8614e6784cc4987771323f8b520bb4922e7481" and "c78ca9dd5b81e23bfbeebd7c25e3732d16532236" have entirely different histories.
6d8614e678
...
c78ca9dd5b
2 changed files with 10 additions and 16 deletions
|
@ -222,9 +222,9 @@ pub fn doRepl(allocator: *std.mem.Allocator, args_it: var) !void {
|
||||||
|
|
||||||
// taking address is fine, because runqs_cmd lives in the lifetime
|
// taking address is fine, because runqs_cmd lives in the lifetime
|
||||||
// of this function.
|
// of this function.
|
||||||
try cmds_parsed.append(&runqs_cmd.base);
|
try cmds.append(&runqs_cmd.base);
|
||||||
|
|
||||||
try runner_clone.runCommands(cmds_parsed, true);
|
try runner_clone.runCommands(cmds, true);
|
||||||
_ = try stdout.write("\n");
|
_ = try stdout.write("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,15 +24,12 @@ pub const Runner = struct {
|
||||||
image: ?*Image = null,
|
image: ?*Image = null,
|
||||||
|
|
||||||
/// If the runner is in REPL mode
|
/// If the runner is in REPL mode
|
||||||
repl: bool,
|
repl: bool = false,
|
||||||
|
|
||||||
args: [][]u8,
|
|
||||||
|
|
||||||
pub fn init(allocator: *std.mem.Allocator, repl: bool) Runner {
|
pub fn init(allocator: *std.mem.Allocator, repl: bool) Runner {
|
||||||
return Runner{
|
return Runner{
|
||||||
.allocator = allocator,
|
.allocator = allocator,
|
||||||
.repl = repl,
|
.repl = repl,
|
||||||
.args = std.process.argsAlloc(allocator) catch unreachable,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,12 +41,7 @@ pub const Runner = struct {
|
||||||
|
|
||||||
pub fn clone(self: *Runner) !Runner {
|
pub fn clone(self: *Runner) !Runner {
|
||||||
var cloned_image = if (self.image) |image| try image.clone() else null;
|
var cloned_image = if (self.image) |image| try image.clone() else null;
|
||||||
return Runner{
|
return Runner{ .allocator = self.allocator, .image = cloned_image };
|
||||||
.allocator = self.allocator,
|
|
||||||
.image = cloned_image,
|
|
||||||
.repl = self.repl,
|
|
||||||
.args = self.args,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn resolveArg(self: *Runner, load_path: []const u8) ![]const u8 {
|
fn resolveArg(self: *Runner, load_path: []const u8) ![]const u8 {
|
||||||
|
@ -65,12 +57,14 @@ pub const Runner = struct {
|
||||||
// ':0' should ALWAYS point to the image.
|
// ':0' should ALWAYS point to the image.
|
||||||
if (self.repl) index += 3 else index += 2;
|
if (self.repl) index += 3 else index += 2;
|
||||||
|
|
||||||
std.debug.warn("ARGS!! {} \n", .{self.args.len});
|
var args = try std.process.argsAlloc(self.allocator);
|
||||||
for (self.args) |arg, idx| {
|
defer std.process.argsFree(self.allocator, args);
|
||||||
|
std.debug.warn("ARGS!! {} \n", .{args.len});
|
||||||
|
for (args) |arg, idx| {
|
||||||
std.debug.warn("arg{} = {}\n", .{ idx, arg });
|
std.debug.warn("arg{} = {}\n", .{ idx, arg });
|
||||||
}
|
}
|
||||||
std.debug.warn("fetch arg idx={}, val={}\n", .{ index, self.args[index] });
|
std.debug.warn("fetch arg idx={}, val={}\n", .{ index, args[index] });
|
||||||
return self.args[index];
|
return args[index];
|
||||||
} else {
|
} else {
|
||||||
return load_path;
|
return load_path;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue