Skip to content
Browse files
Ignore SIGPIPE in subprocesses

Reviewed by Adrian Perez de Castro.

One common case where ignoring SIGPIPE is desired is to avoid issues
when logging to journald and it crashes. As stated in

"In order to react gracefully in this (journald stopped) case it is
recommended that programs logging to standard output/error ignore such

* Shared/AuxiliaryProcess.cpp: Avoid default platformInitialize on
* Shared/unix/AuxiliaryProcessMain.cpp:
(WebKit::AuxiliaryProcess::platformInitialize): Added, ignore SIGPIPE.

Canonical link:
git-svn-id: 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
lauromoura committed May 23, 2022
1 parent cd8ba24 commit a7a9b429afb7e75c61e25102a9bb38351cf39aee
Showing 2 changed files with 13 additions and 0 deletions.
@@ -219,9 +219,12 @@ void AuxiliaryProcess::applyProcessCreationParameters(const AuxiliaryProcessCrea


#if !OS(UNIX)
void AuxiliaryProcess::platformInitialize(const AuxiliaryProcessInitializationParameters&)

void AuxiliaryProcess::initializeSandbox(const AuxiliaryProcessInitializationParameters&, SandboxInitializationParameters&)
@@ -28,6 +28,7 @@

#include <JavaScriptCore/Options.h>
#include <WebCore/ProcessIdentifier.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>

@@ -48,4 +49,13 @@ bool AuxiliaryProcessMainCommon::parseCommandLine(int argc, char** argv)
return true;

void AuxiliaryProcess::platformInitialize(const AuxiliaryProcessInitializationParameters&)
struct sigaction signalAction;
memset(&signalAction, 0, sizeof(signalAction));
signalAction.sa_handler = SIG_IGN;
RELEASE_ASSERT(!sigaction(SIGPIPE, &signalAction, nullptr));

} // namespace WebKit

0 comments on commit a7a9b42

Please sign in to comment.