Page MenuHomePhabricator

D7797.id17640.diff

D7797.id17640.diff

diff --git a/scripts/__init_script__.php b/scripts/__init_script__.php
--- a/scripts/__init_script__.php
+++ b/scripts/__init_script__.php
@@ -1,5 +1,14 @@
<?php
+function __phutil_sigabrt_handler__($signal_number) {
+ $e = new Exception();
+ $pid = getmypid();
+ // Some phabricator daemons may not be attached to a terminal.
+ Filesystem::writeFile(sys_get_temp_dir() . "/phabricator_backtrace_" . $pid,
+ $e->getTraceAsString());
+
+}
+
function __phutil_init_script__() {
// Adjust the runtime language configuration to be reasonable and inline with
// expectations. We do this first, then load libraries.
@@ -65,6 +74,15 @@
require_once $root.'/src/__phutil_library_init__.php';
PhutilErrorHandler::initialize();
+
+ if (function_exists('pcntl_signal')) {
+ if (!pcntl_signal(SIGHUP, "__phutil_sigabrt_handler__")) {
+ echo "WARNING: Unable to register SIGHUP handler\n";
+ }
+ } else {
+ echo "WARNING: function pcntl_signal not available. ";
+ echo "Not registering SIGHUP handler\n";
+ }
}
__phutil_init_script__();

File Metadata

Mime Type
text/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/wn/w4/g4hhtcv6uwe3fntq
Default Alt Text
D7797.id17640.diff (1 KB)

Event Timeline