| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 class Shell(object): | 6 class Shell(object): |
| 7 """Represents an abstract Mojo shell.""" | 7 """Represents an abstract Mojo shell.""" |
| 8 | 8 |
| 9 def ServeLocalDirectory(self, local_dir_path, port=0, | 9 def ServeLocalDirectory(self, local_dir_path, port=0, |
| 10 additional_mappings=None): | 10 additional_mappings=None): |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 def Run(self, arguments): | 37 def Run(self, arguments): |
| 38 """Runs the shell with given arguments until shell exits, passing the stdout | 38 """Runs the shell with given arguments until shell exits, passing the stdout |
| 39 mingled with stderr produced by the shell onto the stdout. | 39 mingled with stderr produced by the shell onto the stdout. |
| 40 | 40 |
| 41 Returns: | 41 Returns: |
| 42 Exit code retured by the shell or None if the exit code cannot be | 42 Exit code retured by the shell or None if the exit code cannot be |
| 43 retrieved. | 43 retrieved. |
| 44 """ | 44 """ |
| 45 raise NotImplementedError() | 45 raise NotImplementedError() |
| 46 | 46 |
| 47 def RunAndGetOutput(self, arguments): | 47 def RunAndGetOutput(self, arguments, timeout=None): |
| 48 """Runs the shell with given arguments until shell exits and returns the | 48 """Runs the shell with given arguments until shell exits and returns the |
| 49 output. | 49 output. |
| 50 | 50 |
| 51 Args: | 51 Args: |
| 52 arguments: list of arguments for the shell | 52 arguments: list of arguments for the shell |
| 53 timeout: maximum running time in seconds, after which the shell will be |
| 54 terminated |
| 53 | 55 |
| 54 Returns: | 56 Returns: |
| 55 A tuple of (return_code, output). |return_code| is the exit code returned | 57 A tuple of (return_code, output, did_time_out). |return_code| is the exit |
| 56 by the shell or None if the exit code cannot be retrieved. |output| is the | 58 code returned by the shell or None if the exit code cannot be retrieved. |
| 57 stdout mingled with the stderr produced by the shell. | 59 |output| is the stdout mingled with the stderr produced by the shell. |
| 60 |did_time_out| is True iff the shell was terminated because it exceeded |
| 61 the |timeout| and False otherwise. |
| 58 """ | 62 """ |
| 59 raise NotImplementedError() | 63 raise NotImplementedError() |
| OLD | NEW |