diff options
author | davidot <davidot@serenityos.org> | 2022-09-13 23:01:41 +0200 |
---|---|---|
committer | Andrew Kaster <andrewdkaster@gmail.com> | 2022-10-12 12:00:21 -0600 |
commit | 49e3b387acb1a3489b44d2ed2afddfd857a2860c (patch) | |
tree | e89954a2401e2462bc23e340f7b59474ebd3c96d /Tests/LibJS/test-test262.cpp | |
parent | d9360676cd043ccb0cb8415c7284b7ce4b24e57a (diff) | |
download | serenity-49e3b387acb1a3489b44d2ed2afddfd857a2860c.zip |
test-test262: Close the output file stream after writing
Without this the runner is waiting for new tests which will never come
and test-test262 is waiting for output which never comes since the
runner is blocked.
Also finish off a comment, and make the variables follow serenity style.
Diffstat (limited to 'Tests/LibJS/test-test262.cpp')
-rw-r--r-- | Tests/LibJS/test-test262.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Tests/LibJS/test-test262.cpp b/Tests/LibJS/test-test262.cpp index e94bafdfe8..8dad872073 100644 --- a/Tests/LibJS/test-test262.cpp +++ b/Tests/LibJS/test-test262.cpp @@ -161,12 +161,12 @@ public: bool write_lines(Span<String> lines) { // It's possible the process dies before we can write all the tests - // to the stdin. So make sure that - struct sigaction act { }; - struct sigaction oldAct; - act.sa_flags = 0; - act.sa_handler = SIG_IGN; - if (sigaction(SIGPIPE, &act, &oldAct) < 0) { + // to the stdin. So make sure that we don't crash but just stop writing. + struct sigaction action_handler { }; + struct sigaction old_action_handler; + action_handler.sa_flags = 0; + action_handler.sa_handler = SIG_IGN; + if (sigaction(SIGPIPE, &action_handler, &old_action_handler) < 0) { perror("sigaction"); return false; } @@ -176,8 +176,11 @@ public: break; } + // Ensure that the input stream ends here, whether we were able to write all lines or not + m_output->close(); + // It's not really a problem if this signal failed - if (sigaction(SIGPIPE, &oldAct, nullptr) < 0) + if (sigaction(SIGPIPE, &old_action_handler, nullptr) < 0) perror("sigaction"); return true; |