gpt4 book ai didi

linux - 管道的奇怪 Steam 更新行为

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:58:07 24 4
gpt4 key购买 nike

这个程序的 STDOUT 中有一个奇怪的行为。

如果我执行程序:./steam -command update -game "Counter-Strike Source"-dir .输出下一个:

Checking bootstrapper version ...
Updating Installation
Determining which depot(s) to install/update...
5 depot(s) will be installed/updated
0:02 Checking local files and building download list for depot 242 'Counter-Strike Source Shared' version 129
0:02 Connecting content server session for version 129
0:03 [80.239.194.162:27030] Connecting...
0:06 [80.239.194.162:27030] Failed. Failed to connect to 80.239.194.162:27030, errno 115 "Operation now in progress"
0:06 [81.171.68.195:27030] Connecting...
0:07 [81.171.68.195:27030] Connection established; handshaking...
0:08 [81.171.68.195:27030] Sending login message...
0:08 Fetching version 129 manifest
...

出于任何奇怪的原因,如果我使用管道和三通以这种方式将其记录到文件中:./steam -command update -game "Counter-Strike Source"-dir 。 |开球日志唯一输出程序的是:

Checking bootstrapper version ...
Updating Installation
Determining which depot(s) to install/update...
5 depot(s) will be installed/updated

仅此而已。相同的文本出现在日志文件和屏幕上。程序仍然开始更新文件。知道为什么会这样吗?

注意:缺少的行不是来自 STDERR

注2:./steam 不会创建任何子进程或额外进程

最佳答案

我猜程序正在检查 isatty(3) 来决定是否显示进度输出。如果是这种情况,那么如果您确实将它捕获到一个文件中,您可能不会得到非常合理的输出,因为它可能使用各种控制字符来使输出更加人性化。

您可以尝试在连接到 TTY 时捕获程序的输出,方法是运行:

script -c "./steam -command update ..." logfile

关于linux - 管道的奇怪 Steam 更新行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13335692/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com