| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2012 The LUCI Authors. All rights reserved. | 2 # Copyright 2012 The LUCI Authors. All rights reserved. |
| 3 # Use of this source code is governed under the Apache License, Version 2.0 | 3 # Use of this source code is governed under the Apache License, Version 2.0 |
| 4 # that can be found in the LICENSE file. | 4 # that can be found in the LICENSE file. |
| 5 | 5 |
| 6 """Runs a command with optional isolated input/output. | 6 """Runs a command with optional isolated input/output. |
| 7 | 7 |
| 8 Despite name "run_isolated", can run a generic non-isolated command specified as | 8 Despite name "run_isolated", can run a generic non-isolated command specified as |
| 9 args. | 9 args. |
| 10 | 10 |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 sys.stderr.write(OUTLIVING_ZOMBIE_MSG % ('run', grace_period)) | 585 sys.stderr.write(OUTLIVING_ZOMBIE_MSG % ('run', grace_period)) |
| 586 if result['exit_code'] == 0: | 586 if result['exit_code'] == 0: |
| 587 result['exit_code'] = 1 | 587 result['exit_code'] = 1 |
| 588 if fs.isdir(tmp_dir): | 588 if fs.isdir(tmp_dir): |
| 589 try: | 589 try: |
| 590 success = file_path.rmtree(tmp_dir) | 590 success = file_path.rmtree(tmp_dir) |
| 591 except OSError as e: | 591 except OSError as e: |
| 592 logging.error('Failure with %s', e) | 592 logging.error('Failure with %s', e) |
| 593 success = False | 593 success = False |
| 594 if not success: | 594 if not success: |
| 595 sys.stderr.write(OUTLIVING_ZOMBIE_MSG % ('run', grace_period)) | 595 sys.stderr.write(OUTLIVING_ZOMBIE_MSG % ('temp', grace_period)) |
| 596 if result['exit_code'] == 0: | 596 if result['exit_code'] == 0: |
| 597 result['exit_code'] = 1 | 597 result['exit_code'] = 1 |
| 598 | 598 |
| 599 # This deletes out_dir if leak_temp_dir is not set. | 599 # This deletes out_dir if leak_temp_dir is not set. |
| 600 if out_dir: | 600 if out_dir: |
| 601 isolated_stats = result['stats'].setdefault('isolated', {}) | 601 isolated_stats = result['stats'].setdefault('isolated', {}) |
| 602 result['outputs_ref'], success, isolated_stats['upload'] = ( | 602 result['outputs_ref'], success, isolated_stats['upload'] = ( |
| 603 delete_and_upload(storage, out_dir, leak_temp_dir)) | 603 delete_and_upload(storage, out_dir, leak_temp_dir)) |
| 604 if not success and result['exit_code'] == 0: | 604 if not success and result['exit_code'] == 0: |
| 605 result['exit_code'] = 1 | 605 result['exit_code'] = 1 |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1095 return 1 | 1095 return 1 |
| 1096 | 1096 |
| 1097 | 1097 |
| 1098 if __name__ == '__main__': | 1098 if __name__ == '__main__': |
| 1099 subprocess42.inhibit_os_error_reporting() | 1099 subprocess42.inhibit_os_error_reporting() |
| 1100 # Ensure that we are always running with the correct encoding. | 1100 # Ensure that we are always running with the correct encoding. |
| 1101 fix_encoding.fix_encoding() | 1101 fix_encoding.fix_encoding() |
| 1102 file_path.enable_symlink() | 1102 file_path.enable_symlink() |
| 1103 | 1103 |
| 1104 sys.exit(main(sys.argv[1:])) | 1104 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |