OLD | NEW |
1 # Copyright (c) 2009, Google Inc. All rights reserved. | 1 # Copyright (c) 2009, Google Inc. All rights reserved. |
2 # Copyright (c) 2009 Apple Inc. All rights reserved. | 2 # Copyright (c) 2009 Apple Inc. All rights reserved. |
3 # | 3 # |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 stdin=stdin, | 384 stdin=stdin, |
385 stdout=self.PIPE, | 385 stdout=self.PIPE, |
386 stderr=stderr, | 386 stderr=stderr, |
387 cwd=cwd, | 387 cwd=cwd, |
388 env=env, | 388 env=env, |
389 close_fds=self._should_close_fds()) | 389 close_fds=self._should_close_fds()) |
390 output = process.communicate(string_to_communicate)[0] | 390 output = process.communicate(string_to_communicate)[0] |
391 | 391 |
392 # run_command automatically decodes to unicode() unless explicitly told
not to. | 392 # run_command automatically decodes to unicode() unless explicitly told
not to. |
393 if decode_output: | 393 if decode_output: |
394 output = output.decode(self._child_process_encoding()) | 394 output = output.decode(self._child_process_encoding(), errors="repla
ce") |
395 | 395 |
396 # wait() is not threadsafe and can throw OSError due to: | 396 # wait() is not threadsafe and can throw OSError due to: |
397 # http://bugs.python.org/issue1731717 | 397 # http://bugs.python.org/issue1731717 |
398 exit_code = process.wait() | 398 exit_code = process.wait() |
399 | 399 |
400 if debug_logging: | 400 if debug_logging: |
401 _log.debug('"%s" took %.2fs' % (self.command_for_printing(args), tim
e.time() - start_time)) | 401 _log.debug('"%s" took %.2fs' % (self.command_for_printing(args), tim
e.time() - start_time)) |
402 | 402 |
403 if return_exit_code: | 403 if return_exit_code: |
404 return exit_code | 404 return exit_code |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 pool.close() | 478 pool.close() |
479 pool.join() | 479 pool.join() |
480 | 480 |
481 | 481 |
482 def _run_command_thunk(cmd_line_and_cwd): | 482 def _run_command_thunk(cmd_line_and_cwd): |
483 # Note that this needs to be a bare module (and hence Picklable) method to w
ork with multiprocessing.Pool. | 483 # Note that this needs to be a bare module (and hence Picklable) method to w
ork with multiprocessing.Pool. |
484 (cmd_line, cwd) = cmd_line_and_cwd | 484 (cmd_line, cwd) = cmd_line_and_cwd |
485 proc = subprocess.Popen(cmd_line, cwd=cwd, stdout=subprocess.PIPE, stderr=su
bprocess.PIPE) | 485 proc = subprocess.Popen(cmd_line, cwd=cwd, stdout=subprocess.PIPE, stderr=su
bprocess.PIPE) |
486 stdout, stderr = proc.communicate() | 486 stdout, stderr = proc.communicate() |
487 return (proc.returncode, stdout, stderr) | 487 return (proc.returncode, stdout, stderr) |
OLD | NEW |