Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/uu/tee/src/tee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ pub fn uu_app() -> Command {
.long(options::APPEND)
.short('a')
.help(translate!("tee-help-append"))
.action(ArgAction::SetTrue),
.action(ArgAction::SetTrue)
.overrides_with(options::APPEND),
)
.arg(
Arg::new(options::IGNORE_INTERRUPTS)
Expand Down
24 changes: 24 additions & 0 deletions tests/by-util/test_tee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,30 @@ fn test_tee_append() {
assert_eq!(at.read(file), content.repeat(2));
}

#[test]
fn test_tee_multiple_append_flags() {
// Test for bug: https://bugs.launchpad.net/ubuntu/+source/rust-coreutils/+bug/2134578
// The command should accept multiple -a flags for different files
let (at, mut ucmd) = at_and_ucmd!();
let content = "don't fail me now rust";
let file1 = "log1";
let file2 = "log2";

// Pre-populate files with some content to verify append behavior
at.write(file1, "existing1\n");
at.write(file2, "existing2\n");

ucmd.args(&["-a", file1, "-a", file2])
.pipe_in(content)
.succeeds()
.stdout_is(content);

assert!(at.file_exists(file1));
assert!(at.file_exists(file2));
assert_eq!(at.read(file1), format!("existing1\n{content}"));
assert_eq!(at.read(file2), format!("existing2\n{content}"));
}

#[test]
fn test_readonly() {
let (at, mut ucmd) = at_and_ucmd!();
Expand Down
Loading