summaryrefslogtreecommitdiffstats
path: root/WebKitTools/Scripts/webkitperl
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-07-22 15:37:06 +0100
committerBen Murdoch <benm@google.com>2010-07-27 10:20:25 +0100
commit967717af5423377c967781471ee106e2bb4e11c8 (patch)
tree1e701dc0a12f7f07cce1df4a7681717de77a211b /WebKitTools/Scripts/webkitperl
parentdcc30a9fca45f634b1d3a12b276d3a0ccce99fc3 (diff)
downloadexternal_webkit-967717af5423377c967781471ee106e2bb4e11c8.zip
external_webkit-967717af5423377c967781471ee106e2bb4e11c8.tar.gz
external_webkit-967717af5423377c967781471ee106e2bb4e11c8.tar.bz2
Merge WebKit at r63859 : Initial merge by git.
Change-Id: Ie8096c63ec7c991c9a9cba8bdd9c3b74a3b8ed62
Diffstat (limited to 'WebKitTools/Scripts/webkitperl')
-rw-r--r--WebKitTools/Scripts/webkitperl/httpd.pm51
1 files changed, 31 insertions, 20 deletions
diff --git a/WebKitTools/Scripts/webkitperl/httpd.pm b/WebKitTools/Scripts/webkitperl/httpd.pm
index 240f368..b415db6 100644
--- a/WebKitTools/Scripts/webkitperl/httpd.pm
+++ b/WebKitTools/Scripts/webkitperl/httpd.pm
@@ -154,19 +154,12 @@ sub openHTTPD(@)
close PIDFILE;
if (0 != kill 0, $oldPid) {
print "\nhttpd is already running: pid $oldPid, killing...\n";
- kill 15, $oldPid;
-
- my $retryCount = 20;
- while ((kill(0, $oldPid) != 0) && $retryCount) {
- sleep 1;
- --$retryCount;
- }
-
- if (!$retryCount) {
+ if (!killHTTPD($oldPid)) {
cleanUp();
die "Timed out waiting for httpd to quit";
}
}
+ unlink $httpdPidFile;
}
$httpdPath = "/usr/sbin/httpd" unless ($httpdPath);
@@ -196,22 +189,31 @@ sub openHTTPD(@)
sub closeHTTPD
{
close HTTPDIN;
- my $retryCount = 20;
- if ($httpdPid) {
- kill 15, $httpdPid;
- while (-f $httpdPidFile && $retryCount) {
- sleep 1;
- --$retryCount;
- }
- }
+ my $succeeded = killHTTPD($httpdPid);
cleanUp();
- if (!$retryCount) {
- print STDERR "Timed out waiting for httpd to terminate!\n";
+ unless ($succeeded) {
+ print STDERR "Timed out waiting for httpd to terminate!\n" unless $succeeded;
return 0;
}
return 1;
}
+sub killHTTPD
+{
+ my ($pid) = @_;
+
+ return 1 unless $pid;
+
+ kill 15, $pid;
+
+ my $retryCount = 20;
+ while (kill(0, $pid) && $retryCount) {
+ sleep 1;
+ --$retryCount;
+ }
+ return $retryCount != 0;
+}
+
sub setShouldWaitForUserInterrupt
{
$waitForUserInterrupt = 1;
@@ -219,7 +221,16 @@ sub setShouldWaitForUserInterrupt
sub handleInterrupt
{
- closeHTTPD();
+ # On Cygwin, when we receive a signal Apache is still running, so we need
+ # to kill it. On other platforms (at least Mac OS X), Apache will have
+ # already been killed, and trying to kill it again will cause us to hang.
+ # All we need to do in this case is clean up our own files.
+ if (isCygwin()) {
+ closeHTTPD();
+ } else {
+ cleanUp();
+ }
+
print "\n";
exit(1);
}