| OLD | NEW |
| (Empty) | |
| 1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 # for details. All rights reserved. Use of this source code is governed by a |
| 3 # BSD-style license that can be found in the LICENSE file. |
| 4 # |
| 5 # For now we have to use this trampoline to turn --dart-flags command line |
| 6 # switch into env variable DART_FLAGS. Eventually, DumpRenderTree should |
| 7 # support --dart-flags and this hack may go away. |
| 8 # |
| 9 # Expected invocation: python drt-trampoline.py <path to DRT> <DRT command line> |
| 10 |
| 11 import os |
| 12 import subprocess |
| 13 import sys |
| 14 |
| 15 DART_FLAGS_PREFIX = '--dart-flags=' |
| 16 |
| 17 def main(argv): |
| 18 drt_path = argv[1] |
| 19 command_line = argv[2:] |
| 20 |
| 21 cmd = [drt_path] |
| 22 |
| 23 env = None |
| 24 for arg in command_line: |
| 25 if arg.startswith(DART_FLAGS_PREFIX): |
| 26 env = dict(os.environ.items()) |
| 27 env['DART_FLAGS'] = arg[len(DART_FLAGS_PREFIX):] |
| 28 else: |
| 29 cmd.append(arg) |
| 30 |
| 31 p = subprocess.Popen(cmd, env=env) |
| 32 p.wait() |
| 33 if p.returncode != 0: |
| 34 raise Exception('Failed to run command. return code=%s' % p.returncode) |
| 35 |
| 36 |
| 37 if __name__ == '__main__': |
| 38 try: |
| 39 sys.exit(main(sys.argv)) |
| 40 except StandardError as e: |
| 41 print 'Fail: ' + str(e) |
| 42 sys.exit(1) |
| OLD | NEW |