From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>
---
cmd/hare/build.ha | 9 ++++++++-
cmd/hare/build/queue.ha | 9 ++++++++-
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/cmd/hare/build.ha b/cmd/hare/build.ha
index c08db316..8d583ccb 100644
--- a/cmd/hare/build.ha
+++ b/cmd/hare/build.ha
@@ -176,7 +176,14 @@ fn build(name: str, cmd: *getopt::command) (void | error) = {
fn run(name: str, path: str, args: []str) error = {
const args: []str = if (len(args) != 0) args[1..] else [];
- let cmd = exec::cmd(path, args...)?;
+ let cmd = match(exec::cmd(path, args...)) {
+ case exec::nocmd =>
+ fmt::fatalf("Error: Command not found: {}", path);
+ case let e: exec::error =>
+ return e;
+ case let c: exec::command =>
+ yield c;
+ };
exec::setname(&cmd, name);
exec::exec(&cmd);
};
diff --git a/cmd/hare/build/queue.ha b/cmd/hare/build/queue.ha
index ce5e8bbc..3653254e 100644
--- a/cmd/hare/build/queue.ha
+++ b/cmd/hare/build/queue.ha
@@ -159,7 +159,14 @@ fn run_task(ctx: *context, jobs: *[]job, t: *task) (bool | error) = {
fmt::errorln()?;
};
- let cmd = exec::cmd(ctx.cmds[t.kind], args...)?;
+ let cmd = match(exec::cmd(ctx.cmds[t.kind], args...)) {
+ case exec::nocmd =>
+ fmt::fatalf("Error: Command not found: {}", ctx.cmds[t.kind]);
+ case let e: exec::error =>
+ return e;
+ case let c: exec::command =>
+ yield c;
+ };
path::set(&buf, out)?;
let output = os::create(path::push_ext(&buf, "log")?, 0o644)?;
defer io::close(output)!;
--
2.41.0