Conditions | 2 |
Total Lines | 22 |
Code Lines | 6 |
Lines | 22 |
Ratio | 100 % |
Changes | 0 |
1 | import os |
||
7 | def __init__(self, command, decode_output=True, immediate_execution=True): |
||
8 | """ |
||
9 | Execute a system command. |
||
10 | |||
11 | When decode_output is True, console output is captured, decoded |
||
12 | and returned in list a list of strings. |
||
13 | |||
14 | :param command: Command to execute |
||
15 | :param decode_output: Optionally capture and decode console output |
||
16 | :param immediate_execution: Execute system command during initialization |
||
17 | :return: List of output strings |
||
18 | """ |
||
19 | # Parameter attributes |
||
20 | self.command = command |
||
21 | self._decode_output = decode_output |
||
22 | |||
23 | # Private attributes |
||
24 | self._output, self._success = None, False |
||
25 | |||
26 | # Execute command |
||
27 | if immediate_execution: |
||
28 | self.execute() |
||
29 | |||
64 |