Skip to content

Commit

Permalink
feat(io): add debug logging on error to help track down bug
Browse files Browse the repository at this point in the history
Tests are flaky on Windows [1]. Here's what I see on CI when a failure happens:

    [snip]
    1: [----------] 5 tests from typescript/test_parse_conditional_expression (0 ms total)
    1:
    1: [----------] Global test environment tear-down
    1: [==========] 1879 tests from 145 test suites ran. (9726 ms total)
    1: [  PASSED  ] 1879 tests.
    1:
    1:   YOU HAVE 1 DISABLED TEST
    1:
    1: D:/a/quick-lint-js/quick-lint-js/src/quick-lint-js/io/output-stream.cpp:101: internal check failed in flush_impl: false
    1: quick-lint-js crashed. Please report this bug here:
    1: https://quick-lint-js.com/crash-report/
    1/2 Test #1: quick-lint-js-test ...............***Failed    9.77 sec

Add some debug logs to help isolate the bug.

[1] #859
  • Loading branch information
strager committed Oct 12, 2022
1 parent e6716d5 commit 8e61c9b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/quick-lint-js/io/output-stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ void file_output_stream::flush_impl(string8_view data) {
// (stdout/stderr).
auto write_result = this->file_.write_full(data.data(), data.size());
if (!write_result.ok()) {
std::fprintf(
stderr,
"fatal: file_output_stream::flush_impl failed to write data: %s\n",
write_result.error_to_string().c_str());
std::fflush(stderr);
QLJS_UNIMPLEMENTED();
}
}
Expand Down

0 comments on commit 8e61c9b

Please sign in to comment.