mirror of
https://github.com/uutils/coreutils
synced 2024-10-15 12:24:09 +00:00
cut: set exit code to 1 if dir is specified
This commit is contained in:
parent
5bd00eb791
commit
c8cd355708
|
@ -11,7 +11,7 @@ use std::fs::File;
|
|||
use std::io::{stdin, stdout, BufReader, BufWriter, IsTerminal, Read, Write};
|
||||
use std::path::Path;
|
||||
use uucore::display::Quotable;
|
||||
use uucore::error::{FromIo, UResult, USimpleError};
|
||||
use uucore::error::{set_exit_code, FromIo, UResult, USimpleError};
|
||||
use uucore::line_ending::LineEnding;
|
||||
|
||||
use self::searcher::Searcher;
|
||||
|
@ -319,6 +319,7 @@ fn cut_files(mut filenames: Vec<String>, mode: &Mode) {
|
|||
|
||||
if path.is_dir() {
|
||||
show_error!("{}: Is a directory", filename.maybe_quote());
|
||||
set_exit_code(1);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -219,7 +219,8 @@ fn test_is_a_directory() {
|
|||
|
||||
ucmd.arg("-b1")
|
||||
.arg("some")
|
||||
.run()
|
||||
.fails()
|
||||
.code_is(1)
|
||||
.stderr_is("cut: some: Is a directory\n");
|
||||
}
|
||||
|
||||
|
@ -228,7 +229,8 @@ fn test_no_such_file() {
|
|||
new_ucmd!()
|
||||
.arg("-b1")
|
||||
.arg("some")
|
||||
.run()
|
||||
.fails()
|
||||
.code_is(1)
|
||||
.stderr_is("cut: some: No such file or directory\n");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue