tee命令总是等待EOF吗? [英] Does the tee command always wait for EOF?

查看:2317
本文介绍了tee命令总是等待EOF吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将命令的输出记录到 stdout 以及日志文件。我安装了Cygwin,我正试图使用​​ tee 命令来完成此操作。

I'd like to log the output of a command to stdout as well as to a log file. I've got Cygwin installed and I'm trying to use the tee command to accomplish this.

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

麻烦的是 tee 似乎坚持在输出任何 stdout 或日志文件之前等待文件结束。这带走了所有的点,这是有一个日志文件供将来参考,但也有一些 stdout 日志,所以我可以很容易地看到构建进度。

Trouble is that tee seems to insist on waiting for the end of file before outputting anything to either stdout or the log file. This takes away the point of it all, which is to have a log file for future reference, but also some stdout logging so I can easily see the build progress.

tee 的选项似乎限制为 - append - ignore-interrupts - help - 版本。那么还有另一种方法来得到我想要做什么?

tee's options appear to be limited to --append, --ignore-interrupts, --help, and --version. So is there another method to get to what I'm trying to do?

推荐答案


在将任何
输出到stdout或日志文件之前,坚持等待
文件结束。

tee seems to insist on waiting for the end of file before outputting anything to either stdout or the log file.

这绝对不会发生 - 它会使三通几乎无用。这里是一个简单的测试,我写的,把这个测试,它绝对不等待eof。

This should definitely not be happening - it would render tee nearly useless. Here's a simple test that I wrote that puts this to the test, and it's definitely not waiting for eof.

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

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

这篇关于tee命令总是等待EOF吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆