~tomleb/hare

93a427d2a8ae7630a7582933a8236be4bbdd7b8d — Alexey Yerin 9 months ago 512a72e
cmd/hare: Improve 'Command not found' error message in get_version

Signed-off-by: Alexey Yerin <yyp@disroot.org>
1 files changed, 8 insertions(+), 1 deletions(-)

M cmd/hare/build/util.ha
M cmd/hare/build/util.ha => cmd/hare/build/util.ha +8 -1
@@ 19,7 19,14 @@ use strings;
let buf = path::buffer { ... };

export fn get_version(harec: str) ([]u8 | error) = {
	let cmd = exec::cmd(harec, "-v")?;
	let cmd = match (exec::cmd(harec, "-v")) {
	case let c: exec::command =>
		yield c;
	case exec::nocmd =>
		fmt::fatalf("Error: Command not found: {}", harec);
	case let e: exec::error =>
		return e;
	};
	let pipe = exec::pipe();
	exec::addfile(&cmd, os::stdout_file, pipe.1);
	let proc = exec::start(&cmd)?;