From 1c9b257b980e52a4eb37297ec9d41b382dd4e157 Mon Sep 17 00:00:00 2001 From: Eran Davidovich Date: Fri, 17 Dec 2021 18:02:04 +0200 Subject: [PATCH 1/4] fix: add stdout, err to output --- third_party/pyth/pyth_utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/third_party/pyth/pyth_utils.py b/third_party/pyth/pyth_utils.py index 5a679892..44816e19 100644 --- a/third_party/pyth/pyth_utils.py +++ b/third_party/pyth/pyth_utils.py @@ -39,9 +39,10 @@ def run_or_die(args, die=True, **kwargs): args_readable = " ".join(args) logging.debug(f"CMD RUN: {args_readable}") ret = subprocess.run(args, text=True, **kwargs) - if ret.returncode != 0: - logging.error(f"Return code is: {ret.returncode}") + logging.error( + f"Return code is: {ret.returncode}\nSTDOUT: {ret.stdout}\nSTDERR: {ret.stderr}" + ) if die: sys.exit(ret.returncode) else: From f8b5ea13a9683dbf25de62fe2a3a310b3872d1ab Mon Sep 17 00:00:00 2001 From: Eran Davidovich Date: Fri, 17 Dec 2021 18:03:26 +0200 Subject: [PATCH 2/4] fix: add capture_output --- third_party/pyth/pyth_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/third_party/pyth/pyth_utils.py b/third_party/pyth/pyth_utils.py index 44816e19..5047c3e3 100644 --- a/third_party/pyth/pyth_utils.py +++ b/third_party/pyth/pyth_utils.py @@ -38,7 +38,8 @@ def run_or_die(args, die=True, **kwargs): """ args_readable = " ".join(args) logging.debug(f"CMD RUN: {args_readable}") - ret = subprocess.run(args, text=True, **kwargs) + ret = subprocess.run(args, text=True, **kwargs, capture_output=True) + if ret.returncode != 0: logging.error( f"Return code is: {ret.returncode}\nSTDOUT: {ret.stdout}\nSTDERR: {ret.stderr}" From 647d0d6adb8c4026505cb341e526a07eb9c0126b Mon Sep 17 00:00:00 2001 From: Eran Davidovich Date: Fri, 17 Dec 2021 20:01:34 +0200 Subject: [PATCH 3/4] remove duplicate capture_output --- third_party/pyth/pyth_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/pyth/pyth_utils.py b/third_party/pyth/pyth_utils.py index 5047c3e3..f808229a 100644 --- a/third_party/pyth/pyth_utils.py +++ b/third_party/pyth/pyth_utils.py @@ -38,7 +38,7 @@ def run_or_die(args, die=True, **kwargs): """ args_readable = " ".join(args) logging.debug(f"CMD RUN: {args_readable}") - ret = subprocess.run(args, text=True, **kwargs, capture_output=True) + ret = subprocess.run(args, text=True, **kwargs) if ret.returncode != 0: logging.error( From 55c8c2726580efafb76027f01f6871e0fe6ab234 Mon Sep 17 00:00:00 2001 From: Eran Davidovich Date: Fri, 24 Dec 2021 09:30:36 +0200 Subject: [PATCH 4/4] small fixes --- third_party/pyth/p2w_autoattest.py | 2 +- third_party/pyth/pyth_utils.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/third_party/pyth/p2w_autoattest.py b/third_party/pyth/p2w_autoattest.py index 7a2b9c45..f7d1f241 100755 --- a/third_party/pyth/p2w_autoattest.py +++ b/third_party/pyth/p2w_autoattest.py @@ -220,7 +220,7 @@ while True: ATTESTATIONS["pendingSeqnos"].append(seqno) else: - logging.warn("Warning: Could not get sequence number") + logging.warning("Warning: Could not get sequence number") time.sleep(P2W_ATTEST_INTERVAL) nonce += 1 diff --git a/third_party/pyth/pyth_utils.py b/third_party/pyth/pyth_utils.py index f808229a..f250dabb 100644 --- a/third_party/pyth/pyth_utils.py +++ b/third_party/pyth/pyth_utils.py @@ -41,9 +41,10 @@ def run_or_die(args, die=True, **kwargs): ret = subprocess.run(args, text=True, **kwargs) if ret.returncode != 0: - logging.error( - f"Return code is: {ret.returncode}\nSTDOUT: {ret.stdout}\nSTDERR: {ret.stderr}" - ) + if str(ret.stdout) != '': + logging.info(f"STDOUT: {ret.stdout}") + if str(ret.stderr) != '': + logging.error(f"STDERR: {ret.stderr}") if die: sys.exit(ret.returncode) else: