| OLD | NEW |
| 1 # Copyright 2012 the V8 project authors. All rights reserved. | 1 # Copyright 2012 the V8 project authors. All rights reserved. |
| 2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
| 3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
| 4 # met: | 4 # met: |
| 5 # | 5 # |
| 6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
| 7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
| 8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
| 9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
| 10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 except OSError: | 100 except OSError: |
| 101 sys.stderr.write('Error: Process %s already ended.\n' % process.pid) | 101 sys.stderr.write('Error: Process %s already ended.\n' % process.pid) |
| 102 | 102 |
| 103 # Pseudo object to communicate with timer thread. | 103 # Pseudo object to communicate with timer thread. |
| 104 timeout_result = [False] | 104 timeout_result = [False] |
| 105 | 105 |
| 106 timer = Timer(timeout, kill_process, [process, timeout_result]) | 106 timer = Timer(timeout, kill_process, [process, timeout_result]) |
| 107 timer.start() | 107 timer.start() |
| 108 stdout, stderr = process.communicate() | 108 stdout, stderr = process.communicate() |
| 109 timer.cancel() | 109 timer.cancel() |
| 110 return process.returncode, timeout_result[0], stdout, stderr | 110 |
| 111 return output.Output( |
| 112 process.returncode, |
| 113 timeout_result[0], |
| 114 stdout, |
| 115 stderr, |
| 116 process.pid, |
| 117 ) |
| 111 | 118 |
| 112 | 119 |
| 113 def Execute(args, verbose=False, timeout=None): | 120 def Execute(args, verbose=False, timeout=None): |
| 114 args = [ c for c in args if c != "" ] | 121 args = [ c for c in args if c != "" ] |
| 115 exit_code, timed_out, stdout, stderr = RunProcess( | 122 return RunProcess(verbose, timeout, args=args) |
| 116 verbose, | |
| 117 timeout, | |
| 118 args=args, | |
| 119 ) | |
| 120 return output.Output(exit_code, timed_out, stdout, stderr) | |
| OLD | NEW |