Honor combine_stdout_stderr when the result is created from an exception. am: 17bc37e59b Original change: https://android-review.googlesource.com/c/platform/tools/repohooks/+/3391169 Change-Id: I078f4ea91177ecaeafdba209434478d02e26ad61 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/rh/hooks.py b/rh/hooks.py index 4d42189..d07e0f9 100644 --- a/rh/hooks.py +++ b/rh/hooks.py
@@ -1002,8 +1002,7 @@ # location of the error. if result.returncode: ret.append(rh.results.HookResult( - 'rustfmt', project, commit, - error=(result.stdout or f'rustfmt failed with status {result.returncode}'), + 'rustfmt', project, commit, error=result.stdout, files=(d.file,))) continue # TODO(b/164111102): rustfmt stable does not support --check on stdin.
diff --git a/rh/utils.py b/rh/utils.py index 4f1a063..d4001d6 100644 --- a/rh/utils.py +++ b/rh/utils.py
@@ -426,7 +426,11 @@ if e.errno == errno.EACCES: estr += '; does the program need `chmod a+x`?' if not check: - result = CompletedProcess(args=cmd, stderr=estr, returncode=255) + result = CompletedProcess(args=cmd, returncode=255) + if combine_stdout_stderr: + result.stdout = estr + else: + result.stderr = estr else: raise CalledProcessError( result.returncode, result.cmd, msg=estr,