monty.subprocess module¶
Calling shell processes.
-
class
Command
(command)[source]¶ Bases:
object
Enables to run subprocess commands in a different thread with TIMEOUT option.
- Based on jcollado’s solution:
http://stackoverflow.com/questions/1191374/subprocess-with-timeout/4825933#4825933
- and
-
retcode
¶ Return code of the subprocess
-
killed
¶ True if subprocess has been killed due to the timeout
-
output
¶ stdout of the subprocess
-
error
¶ stderr of the subprocess
Example
com = Command(“sleep 1”).run(timeout=2) print(com.retcode, com.killed, com.output, com.output)
- Parameters
command – Command to execute