I recommend usingĀ invoke
instead of the built-inĀ subprocess
to handle executing any shell command in Python.
Not only does it provide a more user friendly syntax compared to e.g. subprocess.check_output()
:
run('make')
but it also tends to act more like you’d expect especially regarding the output of the command and has easy-to-use parameters such as hide=True
to hide the output of shell commands.
Furthermore, it provides a buch of really useful features such as automatically responding to prompts from the shell command.