mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #951 from gottwald/devel-git-sudo-fix
Added cwd to tempdir in git clone method. Fixes usage with sudo.
This commit is contained in:
commit
d7eed66a06
1 changed files with 2 additions and 1 deletions
|
@ -24,6 +24,7 @@
|
||||||
# that. Contribs welcome! -- MPD
|
# that. Contribs welcome! -- MPD
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
import tempfile
|
||||||
|
|
||||||
def get_version(dest):
|
def get_version(dest):
|
||||||
''' samples the version of the git repo '''
|
''' samples the version of the git repo '''
|
||||||
|
@ -40,7 +41,7 @@ def clone(repo, dest):
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
cmd = "git clone %s %s" % (repo, dest)
|
cmd = "git clone %s %s" % (repo, dest)
|
||||||
cmd = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
cmd = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=tempfile.gettempdir())
|
||||||
(out, err) = cmd.communicate()
|
(out, err) = cmd.communicate()
|
||||||
rc = cmd.returncode
|
rc = cmd.returncode
|
||||||
return (rc, out, err)
|
return (rc, out, err)
|
||||||
|
|
Loading…
Reference in a new issue