compiler-explorer: [BUG]: stdout not collected from a crashing execution
Describe the bug
Reported in a linkedin discussion: When executing this in CE -
#include <iostream>
int main() {
std::cerr << "aaa\n";
std::cout << "bbbb\n";
int* ptr = nullptr;
int x = *ptr;
}
Shows just aaa.
This seems to be due to buffering, as if we add to the cout line -
std::cout << "bbbb\n" << std::flush;
‘bbbb’ is shown as well.
Hopefully something can be done about it in node…
Steps to reproduce
Expected behavior
Reproduction link
https://compiler-explorer.com/z/of49MKWz5
Screenshots
Not applicable
Operating System
No response
Browser version
No response
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 31 (30 by maintainers)
Commits related to this issue
- Let user execution `stdbuf` Currently only maps in the stdbuf and the lib it needs. Tested locally and paths confirmed to exist on prod boxes. See #7239 — committed to compiler-explorer/compiler-explorer by mattgodbolt 2 years ago
- Let user execution `stdbuf` (#7307) Currently only maps in the stdbuf and the lib it needs. Tested locally and paths confirmed to exist on prod boxes. See #7239 — committed to compiler-explorer/compiler-explorer by mattgodbolt 2 years ago
- Let user execution `stdbuf` (#7307) Currently only maps in the stdbuf and the lib it needs. Tested locally and paths confirmed to exist on prod boxes. See #7239 — committed to faramozzayw/compiler-explorer by mattgodbolt 2 years ago
- Fix #7239: Prefix exeutions with `stdbuf -o0` — committed to compiler-explorer/compiler-explorer by OfekShilon 2 years ago
- Fix #7239: Prefix exeutions with `stdbuf -o0` (#7378) Please note this adds the anti-stdout-buffering machinery to all executions - *including of the compilers themselves*. I think this is a good thi... — committed to A-SunsetMkt-Forks/compiler-explorer by OfekShilon 2 years ago
I still prefer us setting up a fake tty. Just needs a bit of a tweak in our sandbox, and a build of the fake tty binary.
https://github.com/compiler-explorer/compiler-explorer/pull/7482/files https://github.com/compiler-explorer/compiler-explorer/issues/7427
When building and running on a terminal - buffered IO does show for crashing apps. This is perceived as ‘normal’ behavior, and if we could replicate that I think we should.