~sircmpwn/hare-dev

hare: hare/build: Print arguments of failed command v1 SUPERSEDED

Haelwenn (lanodan) Monnier: 1
 hare/build: Print arguments of failed command

 2 files changed, 7 insertions(+), 2 deletions(-)
#1066534 alpine.yml success
#1066535 freebsd.yml success
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/hare-dev/patches/45244/mbox | git am -3
Learn more about email & git

[PATCH hare] hare/build: Print arguments of failed command Export this patch

From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>

---
 cmd/hare/build/queue.ha | 8 ++++++--
 cmd/hare/build/types.ha | 1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/cmd/hare/build/queue.ha b/cmd/hare/build/queue.ha
index 973f9350..51309459 100644
--- a/cmd/hare/build/queue.ha
+++ b/cmd/hare/build/queue.ha
@@ -175,10 +175,12 @@ fn run_task(ctx: *context, jobs: *[]job, t: *task) (bool | error) = {
	defer io::close(output)!;
	exec::addfile(&cmd, os::stdout_file, output);
	exec::addfile(&cmd, os::stderr_file, output);
	let args = strings::join(" ", args...);
	static append(jobs, job {
		pid = exec::start(&cmd)?,
		task = t,
		lock = lock,
		args = args,
	});
	return true;
};
@@ -222,10 +224,12 @@ fn await_task(ctx: *context, jobs: *[]job) (size | void | error) = {
		if (ctx.mode == output::DEFAULT) {
			fmt::errorln()?;
		};
		fmt::fatal(ctx.mods[t.idx].name, ctx.cmds[t.kind],
			exec::exitstr(e));

		fmt::fatalf("Failed {} job ({}), command: {} {}",
			ctx.mods[t.idx].name, exec::exitstr(e), ctx.cmds[t.kind], j.args);
	};

	free(j.args);
	cleanup_task(ctx, t)?;
	free_task(t);
	io::close(j.lock)?;
diff --git a/cmd/hare/build/types.ha b/cmd/hare/build/types.ha
index 43470df5..433d0437 100644
--- a/cmd/hare/build/types.ha
+++ b/cmd/hare/build/types.ha
@@ -51,6 +51,7 @@ export type job = struct {
	// fd to be closed once the job has finished, in order to release the
	// [[io::lock]] on it
	lock: io::file,
	args: str,
};

export type output = enum {
-- 
2.41.0
hare/patches: SUCCESS in 1m29s

[hare/build: Print arguments of failed command][0] from [Haelwenn (lanodan) Monnier][1]

[0]: https://lists.sr.ht/~sircmpwn/hare-dev/patches/45244
[1]: mailto:contact+sr.ht@hacktivis.me

✓ #1066534 SUCCESS hare/patches/alpine.yml  https://builds.sr.ht/~sircmpwn/job/1066534
✓ #1066535 SUCCESS hare/patches/freebsd.yml https://builds.sr.ht/~sircmpwn/job/1066535