(cmd, args, env, allowed_to_fail)
| 503 | |
| 504 | |
| 505 | def check_closure_compiler(cmd, args, env, allowed_to_fail): |
| 506 | cmd = cmd + args + ['--version'] |
| 507 | try: |
| 508 | output = run_process(cmd, stdout=PIPE, env=env).stdout |
| 509 | except Exception as e: |
| 510 | if allowed_to_fail: |
| 511 | return False |
| 512 | if isinstance(e, subprocess.CalledProcessError): |
| 513 | sys.stderr.write(e.stdout) |
| 514 | sys.stderr.write(str(e) + '\n') |
| 515 | exit_with_error('closure compiler (%s) did not execute properly!' % shlex.join(cmd)) |
| 516 | |
| 517 | if 'Version:' not in output: |
| 518 | if allowed_to_fail: |
| 519 | return False |
| 520 | exit_with_error('unrecognized closure compiler --version output (%s):\n%s' % (shlex.join(cmd), output)) |
| 521 | |
| 522 | return True |
| 523 | |
| 524 | |
| 525 | def get_closure_compiler_and_env(user_args): |
no test coverage detected