Output in Run-tool not complete
已回答
In CLion2018.1 on MS Windows 10, using MSYS2 and MinGW-w64-x86_64,
when I have this very simple program running over 100 integers and sending them to cout:
#include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
for (int i; i<100; i++)
{
std::cout <<i <<": -->"<<std::endl;
}
return 0;
}
in about 50% of the time, when I hit 'Run configuration', the output is incomplete, e.g.:
C:\Users\roger\CLionProjects\Lynda\002\release\002.exe
Hello, World!
0: -->
1: -->
2: -->
3: -->
4: -->
5: -->
Process finished with exit code 0
Whereas running the executable from within an external MS Windows CMD prompt gives all the100 integers.
Is there some buffering or flushing issue here?
Other issues mention similar troubles, for (3rd-party) scripts/commands.
请先登录再写评论。
Hello!
This issue in our tracker looks related: https://youtrack.jetbrains.com/issue/CPP-3787. Feel free to comment or upvote, follow it to get updates.
By the way the issue isn't reproduced with Cygwin, so you can try switching to Cygwin, since this problem most likely is MinGW-only. If this is not possible, then try disabling PTY: go to Help | Find Action, type "Registry..." select it and in the opened list find and disable option run.processes.with.pty. Disabling PTY should help to get the correct output in the Run console. Please note that, unfortunately, the run.processes.with.pty option is not saved after CLion's restart and should be disabled again every time you open CLion (if you need it to be disabled). We have the issue in our tracker about that: https://youtrack.jetbrains.com/issue/CPP-8395. Please check it out.
Hi @Anna, the work-around that disables PTY works for me.