summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2021-05-26 23:03:58 +0430
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-05-27 17:28:41 +0430
commit13c15148897afee146cb1e200056409fed0b67c3 (patch)
treeda0b735272434d39618c07cc08b27c4ccf1d6bb3 /Userland/Libraries
parent578bf6c45e7ede3f9451128e26ea807f31fac2af (diff)
downloadserenity-13c15148897afee146cb1e200056409fed0b67c3.zip
LibTest: Do not cleanly exit when abort() is called
Instead, do the cleanup, remove the signal handler, and abort() again.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibTest/JavaScriptTestRunner.h7
-rw-r--r--Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp12
2 files changed, 17 insertions, 2 deletions
diff --git a/Userland/Libraries/LibTest/JavaScriptTestRunner.h b/Userland/Libraries/LibTest/JavaScriptTestRunner.h
index 62f5d68143..07fcf31f96 100644
--- a/Userland/Libraries/LibTest/JavaScriptTestRunner.h
+++ b/Userland/Libraries/LibTest/JavaScriptTestRunner.h
@@ -181,11 +181,16 @@ inline void TestRunnerGlobalObject::initialize_global_object()
}
}
-inline void cleanup_and_exit()
+inline void cleanup()
{
// Clear the taskbar progress.
if (TestRunner::the() && TestRunner::the()->is_printing_progress())
warn("\033]9;-1;\033\\");
+}
+
+inline void cleanup_and_exit()
+{
+ cleanup();
exit(1);
}
diff --git a/Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp b/Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp
index 5e9889d4ca..64d3c19e0b 100644
--- a/Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp
+++ b/Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp
@@ -32,7 +32,17 @@ static StringView g_program_name { "test-js"sv };
static void handle_sigabrt(int)
{
dbgln("{}: SIGABRT received, cleaning up.", g_program_name);
- cleanup_and_exit();
+ cleanup();
+ struct sigaction act;
+ memset(&act, 0, sizeof(act));
+ act.sa_flags = SA_NOCLDWAIT;
+ act.sa_handler = SIG_DFL;
+ int rc = sigaction(SIGABRT, &act, nullptr);
+ if (rc < 0) {
+ perror("sigaction");
+ exit(1);
+ }
+ abort();
}
int main(int argc, char** argv)