Przeglądaj źródła

Catch an error that came up when running (missing binary)

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

+ 9 - 1
zig/sdl/hello_sdl.zig

@ -170,7 +170,15 @@ const RegexRunner = struct {
170 170
        // stop already running command, restart with new cmd
171 171
        if (self.process) |*process| {
172 172
            if (process.is_running()) {
173
                _ = try process.process.kill();
173
                _ = process.process.kill() catch |err| switch (err) {
174
                    error.FileNotFound => {
175
                        // TODO: report error to user
176
                        std.debug.print("killing: {s}\n", .{err});
177
                    },
178
                    else => {
179
                        return err;
180
                    },
181
                };
174 182
                process.deinit();
175 183
            }
176 184
        }