Title: [295520] trunk/Tools/Scripts/webkitpy/benchmark_runner/http_server_driver/simple_http_server_driver.py
Revision
295520
Author
clo...@igalia.com
Date
2022-06-14 03:12:28 -0700 (Tue, 14 Jun 2022)

Log Message

run-benchmark script fails to find the lsof command on Linux
https://bugs.webkit.org/show_bug.cgi?id=241081

Reviewed by Dewei Zhu.

The lsof command is shipped on Linux typically on /usr/bin meanwhile on
Mac is shipped on /usr/sbin. Check if is on PATH before defaulting to the
Mac path.

* Tools/Scripts/webkitpy/benchmark_runner/http_server_driver/simple_http_server_driver.py:
  (SimpleHTTPServerDriver._find_http_server_port):

Canonical link: https://commits.webkit.org/251525@main

Modified Paths

Diff

Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/http_server_driver/simple_http_server_driver.py (295519 => 295520)


--- trunk/Tools/Scripts/webkitpy/benchmark_runner/http_server_driver/simple_http_server_driver.py	2022-06-14 10:01:45 UTC (rev 295519)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/http_server_driver/simple_http_server_driver.py	2022-06-14 10:12:28 UTC (rev 295520)
@@ -2,6 +2,7 @@
 import os
 import re
 import subprocess
+import shutil
 import sys
 import time
 
@@ -66,7 +67,9 @@
                 self._server_port = connections[0].laddr[1]
         except ImportError:
             try:
-                output = subprocess.check_output(['/usr/sbin/lsof', '-a', '-P', '-iTCP', '-sTCP:LISTEN', '-p', str(self._server_process.pid)])
+                # lsof on Linux is shipped on /usr/bin typically, but on Mac on /usr/sbin
+                lsof_path = shutil.which('lsof') or '/usr/sbin/lsof'
+                output = subprocess.check_output([lsof_path, '-a', '-P', '-iTCP', '-sTCP:LISTEN', '-p', str(self._server_process.pid)])
                 self._server_port = int(re.search(r'TCP .*:(\d+) \(LISTEN\)', str(output)).group(1))
             except Exception as error:
                 _log.info('Error: %s' % error)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to