From 25cf47a1dabc5c9bda1d5abebd0da0964da058df Mon Sep 17 00:00:00 2001 From: Khairul Azhar Kasmiran Date: Thu, 4 Aug 2022 19:33:01 +0800 Subject: [PATCH] gittip: Use Meson's `capture: true` for Python 3.6 compatibility --- librz/util/str.c | 1 + meson.build | 1 + sys/meson_git_wrapper.py | 4 +--- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/librz/util/str.c b/librz/util/str.c index 1842ac3b276..6285e2c28bb 100644 --- a/librz/util/str.c +++ b/librz/util/str.c @@ -4067,6 +4067,7 @@ 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: diff --git a/meson.build b/meson.build index 9954ecb879d..6aa8d3d098d 100644 --- a/meson.build +++ b/meson.build @@ -540,6 +540,7 @@ 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 ) diff --git a/sys/meson_git_wrapper.py b/sys/meson_git_wrapper.py index 304dcf7a1b2..8e73a7fdadc 100755 --- a/sys/meson_git_wrapper.py +++ b/sys/meson_git_wrapper.py @@ -25,9 +25,7 @@ def isCArgSupported(executable, path): def simple_git_execution(args): try: - called = subprocess.run(args, check=True, capture_output=True) - with open("gittip", "w", encoding="utf8") as f: - f.write(called.stdout.decode("utf8").strip()) + called = subprocess.run(args, check=True) sys.exit(called.returncode) except subprocess.CalledProcessError as e: sys.exit(e.returncode)