1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

fix/expr: EXIT_CODE=1 for any return output parsable to 0 (or empty)

This commit is contained in:
Roy Ivy III 2022-12-28 02:48:20 -06:00
parent 812d811ff6
commit 8753fb95c3

View file

@ -74,7 +74,7 @@ fn process_expr(token_strings: &[&str]) -> Result<String, String> {
fn print_expr_ok(expr_result: &str) -> UResult<()> {
println!("{}", expr_result);
if expr_result == "0" || expr_result.is_empty() {
if expr_result.parse::<i32>() == Ok(0) || expr_result.is_empty() {
Err(1.into())
} else {
Ok(())