Compare commits
4 commits
5235482ab4
...
542ba75b01
Author | SHA1 | Date | |
---|---|---|---|
542ba75b01 | |||
c7eb70a06f | |||
0240b10a3c | |||
d6c92c0231 |
3 changed files with 15 additions and 6 deletions
|
@ -95,12 +95,16 @@ pub fn temporaryName(allocator: *std.mem.Allocator) ![]u8 {
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we fail to access it, we assume it doesn't exist and return it.
|
// if we fail to access it, we assume it doesn't exist and return it.
|
||||||
|
var tmp_file: std.fs.File = std.fs.cwd().openFile(
|
||||||
_ = std.fs.cwd().openFile(nam, .{ .read = true, .write = false }) catch |err| {
|
nam,
|
||||||
if (err == error.FileNotFound) {
|
.{ .read = true, .write = false },
|
||||||
return nam;
|
) catch |err| blk: {
|
||||||
}
|
if (err == error.FileNotFound) return nam else continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// if we actually found someone, close the handle so that we don't
|
||||||
|
// get EMFILE later on.
|
||||||
|
tmp_file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return error.TempGenFail;
|
return error.TempGenFail;
|
||||||
|
|
|
@ -208,6 +208,10 @@ pub fn doRepl(allocator: *std.mem.Allocator, args_it: var) !void {
|
||||||
std.debug.warn("repl: error while parsing: {}\n", .{err});
|
std.debug.warn("repl: error while parsing: {}\n", .{err});
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// no command? ignore!
|
||||||
|
if (cmds_parsed.items.len == 0) continue;
|
||||||
|
|
||||||
current = cmds_parsed.items[0].*;
|
current = cmds_parsed.items[0].*;
|
||||||
|
|
||||||
// by cloning the parent runner, we can iteratively write
|
// by cloning the parent runner, we can iteratively write
|
||||||
|
@ -220,7 +224,7 @@ pub fn doRepl(allocator: *std.mem.Allocator, args_it: var) !void {
|
||||||
// of this function.
|
// of this function.
|
||||||
try cmds.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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ const langs = @import("lang.zig");
|
||||||
|
|
||||||
fn printCommandWithParams(stream: var, command: var) !void {
|
fn printCommandWithParams(stream: var, command: var) !void {
|
||||||
const Parameters = @TypeOf(command.parameters);
|
const Parameters = @TypeOf(command.parameters);
|
||||||
|
try stream.print(" {} {}", .{ command.split, command.index });
|
||||||
inline for (@typeInfo(Parameters).Struct.fields) |field| {
|
inline for (@typeInfo(Parameters).Struct.fields) |field| {
|
||||||
if (field.field_type == f32 or field.field_type == f64) {
|
if (field.field_type == f32 or field.field_type == f64) {
|
||||||
try stream.print(" {d}", .{@field(command.parameters, field.name)});
|
try stream.print(" {d}", .{@field(command.parameters, field.name)});
|
||||||
|
|
Loading…
Reference in a new issue