Cygwin terminal buffers STDOUT

六月ゝ 毕业季﹏ 提交于 2019-12-11 14:26:40

问题


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"

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.

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?


回答1:


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).

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



来源:https://stackoverflow.com/questions/37706946/cygwin-terminal-buffers-stdout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!