One function
SubprocessBundler in aws/aws-lambda-builders
The author described this change as “fix: streaming stderr from subprocess started by lambda-builders (#563)”. It counts as a record because the check below fails on the code as it stood at ce114ae88 and passes on 934b2be6e, with nothing else changed between the two runs.
Projectaws/aws-lambda-builders
Fix saved2023-10-27
Sharing licenceApache-2.0 · LICENSE
Change size+15 −3
What the code was meant to do, written into the code itself as a docstring
Wrapper around the Bundler command line utility, encapsulating execution results.
The change
| 27 | 27 | ||
| 28 | 28 | p = self.osutils.popen(invoke_bundler, stdout=self.osutils.pipe, stderr=self.osutils.pipe, cwd=cwd) | |
| 29 | 29 | ||
| 30 | - | out, _ = p.communicate() | |
| 30 | + | out, err = p.communicate() | |
| 31 | 31 | ||
| 32 | 32 | if p.returncode != 0: | |
| 33 | 33 | if p.returncode == GEMFILE_NOT_FOUND: | |
| ⋯ | |||
| 38 | 38 | if self.osutils.directory_exists(check_dir): | |
| 39 | 39 | self.osutils.remove_directory(check_dir) | |
| 40 | 40 | else: | |
| 41 | - | # Bundler has relevant information in stdout, not stderr. | |
| 42 | - | raise BundlerExecutionError(message=out.decode("utf8").strip()) | |
| 41 | + | # Bundler can contain information in both stdout and stderr so we check and log both | |
| 42 | + | err_str = err.decode("utf8").strip() | |
| 43 | + | out_str = out.decode("utf8").strip() | |
| 44 | + | if out_str and err_str: | |
| 45 | + | message_out = f"{out_str}{linesep}{err_str}" | |
| 46 | + | LOG.debug(f"Bundler output: {out_str}") | |
| 47 | + | LOG.debug(f"Bundler error: {err_str}") | |
| 48 | + | elif out_str: | |
| 49 | + | message_out = out_str | |
| 50 | + | LOG.debug(f"Bundler output: {out_str}") | |
| 51 | + | else: | |
| 52 | + | message_out = err_str | |
| 53 | + | LOG.debug(f"Bundler error: {err_str}") | |
| 54 | + | raise BundlerExecutionError(message=message_out) | |
| 43 | 55 | ||
| 44 | 56 | return out.decode("utf8").strip() | |
The check that tells the two apart
fail→pass·tests/unit/workflows/ruby_bundler/test_bundler.py::TestSubprocessBundler::test_raises_BundlerExecutionError_with_both_stderr_and_stdout_text_if_retcode_is_not_0
Check file tests/unit/workflows/ruby_bundler/test_bundler.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before itce114ae88617827614ad0b838c89277383853985
Broken version dated2023-10-25
Moduleaws_lambda_builders.workflows.ruby_bundler.bundler
Units changedSubprocessBundler
Fingerprint1f8d63d2352dfca3
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.