Does tee always expect EOF?

I would like to write the output of the command to stdoutas well as to the log file. I have Cygwin installed, and I'm trying to use the command teeto accomplish this.

devenv mysolution.sln /build myproject "Release|Win32" | tee build.log

The problem is that it teeseems to insist on waiting for the end of the file before outputting anything to stdouteither the log file. This takes away the whole point, that is, to have a log file for future reference, but also a log stdout, so I can easily see the build progress.

teeOptions are limited --append, --ignore-interrupts, --helpand --version. So, is there any other way to understand what I'm trying to do?

+3
source share
3 answers

tee, , - stdout, .

- . , , , eof.

$ cat test
#!/bin/sh
echo "hello"
sleep 5
echo "goodbye"

$ ./test | tee test.log
hello
<pause>
goodbye
+1

- .

devenv mysolution.sln/build myproject "Release | Win32" > build.log &

tail -f build.log

+4

! ( , autoflush ($|) , . , , tee.)

#!/usr/bin/perl -w
use strict;
use IO::File;
$| = 1;
my @fhs = map IO::File->new(">$_"), @ARGV;
while (my $line = <STDIN>) {
    print $line;
    $_->print($line) for @fhs;
}
$_->close for @fhs;

script , . perlmilktee!:-P

+2

Source: https://habr.com/ru/post/1697246/


All Articles