Example using new
I give me correct output,it's also better/safer to use a list then is
run()
and parameter capture_output=True
.I give me correct output,it's also better/safer to use a list then is
shell=False
(default).import subprocess out = subprocess.run(['git', 'log', '--oneline'], capture_output=True) print(out.stdout.decode())