Skip to content

Commit 7f492da

Browse files
authored
Log signals like SIGILL and SIGSEGV before kill -9ing the process (#98)
1 parent 0239918 commit 7f492da

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Source/CommandLine.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,20 @@ static void hideDockIcon()
4040

4141
//==============================================================================
4242
#if JUCE_MAC
43-
static void killWithoutMercy (int)
43+
static void kill9WithSomeMercy (int signal)
4444
{
45-
kill (getpid(), SIGKILL);
45+
juce::Logger::writeToLog ("pluginval received " + juce::String(::strsignal(signal)) + ", exiting immediately");
46+
kill (getpid(), SIGKILL);
4647
}
4748

49+
// Avoid showing the macOS crash dialog, which can cause the process to hang
4850
static void setupSignalHandling()
4951
{
5052
const int signals[] = { SIGFPE, SIGILL, SIGSEGV, SIGBUS, SIGABRT };
5153

5254
for (int i = 0; i < juce::numElementsInArray (signals); ++i)
5355
{
54-
::signal (signals[i], killWithoutMercy);
56+
::signal (signals[i], kill9WithSomeMercy);
5557
::siginterrupt (signals[i], 1);
5658
}
5759
}

0 commit comments

Comments
 (0)