mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
touch/gnu compat: 'touch no-file' exit code should be 1
This commit is contained in:
@@ -168,6 +168,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||
|
||||
if let Err(e) = File::create(path) {
|
||||
show_warning!("cannot touch '{}': {}", path, e);
|
||||
error_code = 1;
|
||||
continue;
|
||||
};
|
||||
|
||||
|
||||
@@ -459,3 +459,10 @@ fn test_touch_system_fails() {
|
||||
.fails()
|
||||
.stderr_contains("setting times of '/'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_touch_trailing_slash() {
|
||||
let (_at, mut ucmd) = at_and_ucmd!();
|
||||
let file = "no-file/";
|
||||
ucmd.args(&[file]).fails();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user