Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F18870164
D16102.id38741.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D16102.id38741.diff
View Options
diff --git a/scripts/ssh/ssh-connect.php b/scripts/ssh/ssh-connect.php
--- a/scripts/ssh/ssh-connect.php
+++ b/scripts/ssh/ssh-connect.php
@@ -4,6 +4,11 @@
// This is a wrapper script for Git, Mercurial, and Subversion. It primarily
// serves to inject "-o StrictHostKeyChecking=no" into the SSH arguments.
+// In some cases, Subversion sends us SIGTERM. If we don't catch the signal and
+// react to it, we won't run object destructors by default and thus won't clean
+// up temporary files. Declare ticks so we can install a signal handler.
+declare(ticks=1);
+
$root = dirname(dirname(dirname(__FILE__)));
require_once $root.'/scripts/__init_script__.php';
@@ -21,6 +26,16 @@
));
$unconsumed_argv = $args->getUnconsumedArgumentVector();
+if (function_exists('pcntl_signal')) {
+ pcntl_signal(SIGTERM, 'ssh_connect_signal');
+}
+
+function ssh_connect_signal($signo) {
+ // This is just letting destructors fire. In particular, we want to clean
+ // up any temporary files we wrote. See T10547.
+ exit(128 + $signo);
+}
+
$pattern = array();
$arguments = array();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Nov 5 2025, 3:49 PM (23 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8287840
Default Alt Text
D16102.id38741.diff (1 KB)
Attached To
Mode
D16102: Install a SIGTERM handler in ssh-connect
Attached
Detach File
Event Timeline
Log In to Comment