Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime errors don't exit non-zero #138

Open
oldaccountdeadname opened this issue Nov 11, 2021 · 0 comments
Open

Runtime errors don't exit non-zero #138

oldaccountdeadname opened this issue Nov 11, 2021 · 0 comments

Comments

@oldaccountdeadname
Copy link

Running Pa'i for part of a checkPhase in Nix, I ran into the following error:

[2021-11-11T05:33:57Z ERROR pahi] runtime error: IO Error: Permission denied (os error 13)

However, Nix completed the check silently, with no indication that anything was wrong as the exit status from Pa'i was 0. This is despite the requested code not actually running, and Pa'i not being able to do the thing it was invoked to do. This potentially misleading exit code is a bug, correct?


For what it's worth, here's the tiny commit I'm using for a violent exit, available for a git am assuming it all looks fine:

From c02c00dea2d43af0c7c1139dc86089a794348645 Mon Sep 17 00:00:00 2001
From: "lincoln auster [they/them]" <[email protected]>
Date: Wed, 10 Nov 2021 22:23:07 -0700
Subject: [PATCH] exit non-zero if a runtime error is encountered

Failing silently is usually not a good thing. If the Wasm child can't
run, for whatever reason, something has gone wrong, and we now return 1.
Why 1? It's not 0.
---
 pahi/src/main.rs | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pahi/src/main.rs b/pahi/src/main.rs
index 9323ced..4a1cfa1 100644
--- a/pahi/src/main.rs
+++ b/pahi/src/main.rs
@@ -75,6 +75,7 @@ fn main() -> Result<()> {
         }
         Err(why) => {
             error!("runtime error: {}", why);
+            std::process::exit(1);
         }
     }
 
-- 
2.33.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant