summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkoverstreet <kent.overstreet@gmail.com>2024-07-30 17:56:43 -0400
committerGitHub <noreply@github.com>2024-07-30 17:56:43 -0400
commit1e5452a02781525b7ccff7a44ad2c7242e786b17 (patch)
tree1a89dc77aaedd22de296d6c390c1970d1f9771fc
parent57cd58db1e7945c65ff03035fc54f69b5b3bd565 (diff)
parentfb6a56bb817485abf984210d135f46068ed6dc19 (diff)
Merge pull request #322 from tmuehlbacher/fix-c-exit-code
Fix C exit code
-rw-r--r--flake.nix2
-rw-r--r--src/bcachefs.rs8
2 files changed, 8 insertions, 2 deletions
diff --git a/flake.nix b/flake.nix
index c670e51f..4dba19d7 100644
--- a/flake.nix
+++ b/flake.nix
@@ -195,7 +195,7 @@
flakeCheck = false;
programs = {
- nixfmt-rfc-style.enable = true;
+ nixfmt.enable = true;
rustfmt.edition = rustfmtToml.edition;
rustfmt.enable = true;
rustfmt.package = fenix.packages.${system}.default.rustfmt;
diff --git a/src/bcachefs.rs b/src/bcachefs.rs
index 0e70d135..0072ca44 100644
--- a/src/bcachefs.rs
+++ b/src/bcachefs.rs
@@ -9,6 +9,7 @@ use std::{
};
use bch_bindgen::c;
+use log::debug;
#[derive(Debug)]
pub struct ErrnoError(pub errno::Errno);
@@ -110,6 +111,11 @@ fn main() -> ExitCode {
"list" => commands::list(args[1..].to_vec()).report(),
"mount" => commands::mount(args, symlink_cmd).report(),
"subvolume" => commands::subvolume(args[1..].to_vec()).report(),
- _ => ExitCode::from(u8::try_from(handle_c_command(args, symlink_cmd)).unwrap()),
+ _ => {
+ let r = handle_c_command(args, symlink_cmd);
+
+ debug!("return code from C command: {r}");
+ ExitCode::from(r as u8)
+ }
}
}