Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
>>> import subprocess
>>> proc = subprocess.Popen(['git', 'clone', '', '/tmp/ds-repo-1'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
>>> print(proc.communicate())
("Cloning into '/tmp/ds-repo-1'...\n", None)

This comment has been minimized.

Copy link

@vartec vartec commented Feb 13, 2015

>>> subprocess.check_output("git clone /tmp/ds-repo-1", shell=True)
Cloning into '/tmp/ds-repo-1'...
remote: Counting objects: 76488, done.
remote: Compressing objects: 100% (425/425), done.
remote: Total 76488 (delta 285), reused 0 (delta 0)
Receiving objects: 100% (76488/76488), 31.78 MiB | 1.01 MiB/s, done.
Resolving deltas: 100% (41870/41870), done.
Checking connectivity... done.

raises CalledProcessError on non-zero exit code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.