commit 1c7a00ccca5dd2122d0cbaeb3717a51e543aee90
parent 3795ae86f2cf9d5486bf810e607d7114a9dde055
Author: Drew DeVault <sir@cmpwn.com>
Date: Mon, 22 Nov 2021 09:33:10 +0100
hare release: fail gracefully if ssh-keygen is missing
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/cmd/hare/release.ha b/cmd/hare/release.ha
@@ -264,7 +264,12 @@ fn choosekey() (str | release_error) = {
os::mkdirs(parent)?;
const path = path::join(home, ".ssh", "id_ed25519");
- const cmd = exec::cmd("ssh-keygen", "-t", "ed25519", "-f", path)?;
+ const cmd = match (exec::cmd("ssh-keygen", "-t", "ed25519", "-f", path)) {
+ case cmd: exec::command =>
+ yield cmd;
+ case err: exec::error =>
+ fmt::fatal("ssh-keygen: command not found. Is openssh installed?");
+ };
const proc = exec::start(&cmd)?;
const status = exec::wait(&proc)?;
exec::check(&status)?;