瀏覽代碼

Merge pull request #425 from preaction/fix-macos-kill

fix search for unix binary on MacOS
George S. Baugh 6 年之前
父節點
當前提交
65480037f0
共有 1 個文件被更改,包括 1 次插入2 次删除
  1. 1 2
      lib/Selenium/CanStartBinary.pm

+ 1 - 2
lib/Selenium/CanStartBinary.pm

@@ -423,8 +423,7 @@ sub shutdown_unix_binary {
     my ($self) = @_;
     my ($self) = @_;
     if (!IS_WIN) {
     if (!IS_WIN) {
         my $cmd = "lsof -t -i :".$self->port();
         my $cmd = "lsof -t -i :".$self->port();
-        my $pid = `$cmd`;
-        chomp $pid;
+        my ( $pid ) = grep { $_ && $_ ne $$ } split /\s+/, scalar `$cmd`;
         if ($pid) {
         if ($pid) {
             print "Killing Driver PID $pid listening on port ".$self->port."...\n";
             print "Killing Driver PID $pid listening on port ".$self->port."...\n";
             eval { kill 'KILL', $pid };
             eval { kill 'KILL', $pid };