From 6f84e56e28ebb2c5fb246cba74031a9008503442 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Tue, 24 Oct 2023 16:33:04 +0200 Subject: [PATCH] ls: return exit code 2 for invalid time-style --- src/uu/ls/src/ls.rs | 2 +- tests/by-util/test_ls.rs | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 41d2f59b1..935741959 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -183,7 +183,7 @@ impl UError for LsError { Self::BlockSizeParseError(_) => 1, Self::ConflictingArgumentDired() => 1, Self::AlreadyListedError(_) => 2, - Self::TimeStyleParseError(_, _) => 1, + Self::TimeStyleParseError(_, _) => 2, } } } diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 15893b0e2..18deb1551 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1737,7 +1737,12 @@ fn test_ls_styles() { .stdout_matches(&re_custom_format); // Also fails due to not having full clap support for time_styles - scene.ucmd().arg("-l").arg("-time-style=invalid").fails(); + scene + .ucmd() + .arg("-l") + .arg("--time-style=invalid") + .fails() + .code_is(2); //Overwrite options tests scene