 Chromium Code Reviews
 Chromium Code Reviews Issue 2748123004:
  xvfb.py complains if command points to a directory.  (Closed)
    
  
    Issue 2748123004:
  xvfb.py complains if command points to a directory.  (Closed) 
  | OLD | NEW | 
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python | 
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be | 
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. | 
| 5 | 5 | 
| 6 """Runs tests with Xvfb and Openbox on Linux and normally on other platforms.""" | 6 """Runs tests with Xvfb and Openbox on Linux and normally on other platforms.""" | 
| 7 | 7 | 
| 8 import os | 8 import os | 
| 9 import os.path | |
| 9 import platform | 10 import platform | 
| 10 import signal | 11 import signal | 
| 11 import subprocess | 12 import subprocess | 
| 12 import sys | 13 import sys | 
| 13 import threading | 14 import threading | 
| 14 | 15 | 
| 15 import test_env | 16 import test_env | 
| 16 | 17 | 
| 17 | 18 | 
| 18 def _kill(proc, send_signal): | 19 def _kill(proc, send_signal): | 
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 if xvfb_script.endswith('.pyc'): | 74 if xvfb_script.endswith('.pyc'): | 
| 74 xvfb_script = xvfb_script[:-1] | 75 xvfb_script = xvfb_script[:-1] | 
| 75 return subprocess.call(['xvfb-run', '-a', "--server-args=-screen 0 " | 76 return subprocess.call(['xvfb-run', '-a', "--server-args=-screen 0 " | 
| 76 "1280x800x24 -ac -nolisten tcp -dpi 96", | 77 "1280x800x24 -ac -nolisten tcp -dpi 96", | 
| 77 xvfb_script] + cmd, env=env) | 78 xvfb_script] + cmd, env=env) | 
| 78 else: | 79 else: | 
| 79 return test_env.run_executable(cmd, env) | 80 return test_env.run_executable(cmd, env) | 
| 80 | 81 | 
| 81 | 82 | 
| 82 def main(): | 83 def main(): | 
| 84 USAGE = 'Usage: xvfb.py [command args...]' | |
| 83 if len(sys.argv) < 2: | 85 if len(sys.argv) < 2: | 
| 86 print >> sys.stderr, USAGE | |
| 87 return 2 | |
| 88 if os.path.isdir(sys.argv[1]): | |
| 
Tom Anderson
2017/03/14 22:43:43
nit: add a comment explaining why we have this cas
 
carlosk
2017/03/14 23:47:23
Done.
 | |
| 84 print >> sys.stderr, ( | 89 print >> sys.stderr, ( | 
| 85 'Usage: xvfb.py [command args...]') | 90 'Invalid command: it\'s a directory') | 
| 86 return 2 | 91 print >> sys.stderr, USAGE | 
| 92 return 3 | |
| 87 return run_executable(sys.argv[1:], os.environ.copy()) | 93 return run_executable(sys.argv[1:], os.environ.copy()) | 
| 88 | 94 | 
| 89 | 95 | 
| 90 if __name__ == "__main__": | 96 if __name__ == "__main__": | 
| 91 sys.exit(main()) | 97 sys.exit(main()) | 
| OLD | NEW |