Honor combine_stdout_stderr when the result is created from an exception. Revert a workaround for rustfmt which should no longer be needed. Test: none Bug: 379935631 Change-Id: I22263ba77f34067bf6450faa45ae822a18519e2a Reviewed-on: https://android-review.googlesource.com/c/platform/tools/repohooks/+/3391169 Presubmit-Verified: Treehugger Robot <android-test-infra-workplan-finisher@system.gserviceaccount.com> Performance: CrystalBall Performance Presubmit <android-crystalball-presubmit-eng@google.com> Reviewed-by: Tim Bain <tbain@google.com> Open-Source-Licensing: Lint 🤖 <ayeaye-gerrit@google.com> Lint: Lint 🤖 <ayeaye-gerrit@google.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,