Opens a process object via subprocess.Popen(). :param string|list cmd: A list or string representing the command to run. :param **kwargs: Additional kwargs to pass through to subprocess.Popen. :return: A `subprocess.Popen` object. :raises: `Executor.ExecutableNotFoun
(cls, cmd, **kwargs)
| 59 | |
| 60 | @classmethod |
| 61 | def open_process(cls, cmd, **kwargs): |
| 62 | """Opens a process object via subprocess.Popen(). |
| 63 | |
| 64 | :param string|list cmd: A list or string representing the command to run. |
| 65 | :param **kwargs: Additional kwargs to pass through to subprocess.Popen. |
| 66 | :return: A `subprocess.Popen` object. |
| 67 | :raises: `Executor.ExecutableNotFound` when the executable requested to run does not exist. |
| 68 | """ |
| 69 | assert len(cmd) > 0, "cannot execute an empty command!" |
| 70 | |
| 71 | try: |
| 72 | return subprocess.Popen(cmd, **kwargs) |
| 73 | except (IOError, OSError) as e: |
| 74 | if e.errno == errno.ENOENT: |
| 75 | raise cls.ExecutableNotFound(cmd, e) |
| 76 | else: |
| 77 | raise cls.ExecutionError(repr(e), cmd, e) |
| 78 | |
| 79 | @classmethod |
| 80 | def execute(cls, cmd, stdin_payload=None, **kwargs): |
no outgoing calls