Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Unified Diff: testing/xvfb.py

Issue 2748123004: xvfb.py complains if command points to a directory. (Closed)
Patch Set: Better error message. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/xvfb.py
diff --git a/testing/xvfb.py b/testing/xvfb.py
index a5620e7cde4072d7bd8b5f6bef54b27af767d9e1..3ca9aa8aa154902b87d410a4b93ce223015b27a8 100755
--- a/testing/xvfb.py
+++ b/testing/xvfb.py
@@ -6,6 +6,7 @@
"""Runs tests with Xvfb and Openbox on Linux and normally on other platforms."""
import os
+import os.path
import platform
import signal
import subprocess
@@ -80,10 +81,19 @@ def run_executable(cmd, env):
def main():
+ USAGE = 'Usage: xvfb.py [command args...]'
if len(sys.argv) < 2:
- print >> sys.stderr, (
- 'Usage: xvfb.py [command args...]')
+ print >> sys.stderr, USAGE
return 2
+
+ # If the user still thinks the first argument is the execution directory then
+ # print a friendly error message and quit.
+ if os.path.isdir(sys.argv[1]):
+ print >> sys.stderr, (
+ 'Invalid command: \"%s\" is a directory' % sys.argv[1])
+ print >> sys.stderr, USAGE
+ return 3
+
return run_executable(sys.argv[1:], os.environ.copy())
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698