gittip: Use subprocess.PIPE instead for Python 3.6 compatibility (#2873)
This commit is contained in:
parent
b85636317c
commit
dc8cd44db4
3 changed files with 8 additions and 5 deletions
|
|
@ -4067,7 +4067,6 @@ RZ_API char *rz_str_version(const char *program) {
|
|||
if (!gittip || !*rz_str_trim_head_ro(gittip)) {
|
||||
goto done;
|
||||
}
|
||||
rz_str_trim(gittip);
|
||||
rz_strbuf_append(sb, "\n");
|
||||
rz_strbuf_appendf(sb, "commit: %s", gittip);
|
||||
done:
|
||||
|
|
|
|||
|
|
@ -524,7 +524,6 @@ if git_exe.found() and fs.exists('.git')
|
|||
build_by_default: true,
|
||||
output: 'gittip',
|
||||
command: [py3_exe, git_exe_repo_py, git_exe, repo, 'rev-parse', 'HEAD'],
|
||||
capture: true,
|
||||
install: true,
|
||||
install_dir: rizin_bindir
|
||||
)
|
||||
|
|
|
|||
|
|
@ -23,9 +23,13 @@ def isCArgSupported(executable, path):
|
|||
return False
|
||||
|
||||
|
||||
def simple_git_execution(args):
|
||||
def simple_git_execution(args, gittip_dir=None):
|
||||
try:
|
||||
called = subprocess.run(args, check=True)
|
||||
called = subprocess.run(args, check=True, stdout=subprocess.PIPE)
|
||||
if gittip_dir is not None:
|
||||
os.chdir(gittip_dir)
|
||||
with open("gittip", "w", encoding="utf8") as f:
|
||||
f.write(called.stdout.decode("utf8").strip())
|
||||
sys.exit(called.returncode)
|
||||
except subprocess.CalledProcessError as e:
|
||||
sys.exit(e.returncode)
|
||||
|
|
@ -53,8 +57,9 @@ def main():
|
|||
if isCArgSupported(git_exe, repo_path):
|
||||
simple_git_execution([git_exe, "-C", repo_path] + args)
|
||||
else:
|
||||
gittip_dir = os.getcwd()
|
||||
os.chdir(repo_path)
|
||||
simple_git_execution([git_exe] + args)
|
||||
simple_git_execution([git_exe] + args, gittip_dir)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
Loading…
Reference in a new issue