Przeglądaj źródła

Support executing random programs (!)

Luna Stadler 4 lat temu
rodzic
commit
2337ce5e73
1 zmienionych plików z 3 dodań i 1 usunięć
  1. 3 1
      zig/sdl/hello_sdl.zig

+ 3 - 1
zig/sdl/hello_sdl.zig

@ -213,8 +213,10 @@ fn runCommand(raw_cmd: []const u8, allocator: *std.mem.Allocator) ![]const u8 {
213 213
    else if (std.mem.startsWith(u8, cmd, "man "))
214 214
        // TODO: handle `man 5 sway`
215 215
        &[_][]const u8{ "man", cmd["man ".len..] }
216
    else if (cmd.len > 0 and std.ascii.isDigit(cmd[0]))
217
        &[_][]const u8{ "/usr/bin/qalc", "-terse", cmd }
216 218
    else
217
        &[_][]const u8{ "/usr/bin/qalc", "-terse", cmd };
219
        &[_][]const u8{ "bash", "-c", cmd };
218 220
    for (argv) |arg| {
219 221
        std.debug.print("'{s}' ", .{arg});
220 222
    }