M src/tee.c => src/tee.c +1 -1
@@ 74,7 74,7 @@ cleanup:
int
main(int argc, char *argv[])
{
- int aflag = 0;
+ int aflag = O_TRUNC;
char opt;
while ((opt = getopt(argc, argv, "ai")) != -1) {
M test/tee => test/tee +6 -1
@@ 10,7 10,12 @@ should_handle_zero_file() (
should_handle_one_file() (
stdout="$(echo "tesT 1ine" | tee "$TMPDIR"/one-file)"
res="$(cat "$TMPDIR"/one-file)"
- [ "$res" = "tesT 1ine" ] && [ "$res" = "$stdout" ]
+ [ "$res" = "tesT 1ine" ] && [ "$res" = "$stdout" ] || return 1
+
+ echo "a really long line for test" >"$TMPDIR"/one-file
+ stdout="$(echo "shorter line" | tee "$TMPDIR"/one-file)"
+ res="$(cat "$TMPDIR"/one-file)"
+ [ "$res" = "shorter line" ] && [ "$res" = "$stdout" ]
)
should_handle_two_files() (