Cygwin终端缓冲器STDOUT [英] Cygwin terminal buffers STDOUT

查看:69
本文介绍了Cygwin终端缓冲器STDOUT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Altera Quartus软件,该软件带有自己的Cygwin发行版和一个哑终端,根据Altera在我的开始"菜单中放置的快捷方式,哑终端使用

I use Altera Quartus software which comes with its own Cygwin distribution and a dumb terminal which, according to the shortcut placed in my Start Menu by Altera, is run using

cmd.exe /c "c:\altera\15.1\nios2eds\NiosII Command Shell.bat"

,此批处理文件在其中配置Quartus的环境并启动bash.当我使用此窗口运行Altera工具时,它们的输出会立即显示(没有缓冲)并显示为彩色.

where this batch file configures the environment for Quartus and launches bash. When I use this window to run Altera tools, their output comes out immediately (not buffered) and in color.

我也有自己的Cygwin安装,带有Xserver和终端(即lxterminal,mrxvt,xfce4-terminal等).我已经修改了Altera的批处理文件以在Cygwin中配置Altera的环境,并且我可以运行Altera的所有工具.但是,当我运行这些工具时,它们的输出既不是彩色的(虽然没什么大不了,但令人惊讶),并且在所有输出同时出现时一直缓冲到执行结束.

I also have my own Cygwin installation with an Xserver and terminals (i.e. lxterminal, mrxvt, xfce4-terminal, etc). I have adapted Altera's batch file to configure Altera's environment within my Cygwin and I can run all of Altera's tools. However, when I run these tools, their output is neither in color (not a big deal but surprising), and is buffered until the end of execution when all output appears at the same time.

有人对如何绕过这种缓冲有任何想法吗?

Does anyone have any ideas on how to bypass this buffering?

推荐答案

以某种方式,您的工具认为输出不是终端而是文件.对于文件,该工具本身将创建一个缓冲区(在Linux上为4K).对于终端,输出通常是行缓冲的(即,输出代码将收集所有字符,直到检测到行尾,然后一次打印所有字符).

Somehow, your tools are thinking that the output is not a terminal but a file. For files, the tool itself will create a buffer (4K on Linux). For terminals, the output is usually line buffered (i.e. the output code will collect all the characters until an end-of-line is detected and then print them all at once).

为进一步帮助您,我们需要更多信息,您如何修改Altera的批处理文件以在我的Cygwin中配置Altera的环境"

To help you further, we need more information how you "adapted Altera's batch file to configure Altera's environment within my Cygwin"

这篇关于Cygwin终端缓冲器STDOUT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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