Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libcnb-test: Refactor run_pack_command and improve panic messages #619

Merged
merged 1 commit into from
Jul 31, 2023

Conversation

edmorley
Copy link
Member

@edmorley edmorley commented Jul 27, 2023

This:

  • Moves the internal run_pack_command to utils and makes it generic, so it can be used internally when calling other external processes (such as Docker CLI, in the upcoming Bollard migration).
  • Makes run_command return a Result instead of panicing directly, so that the caller is both in control of the outcome and can add additional context to the panic error message.
  • Moves the "expected failure" handling out of run_command and up to the single caller that requires that feature, to avoid adding boilerplate to all of the other call-sites (which will increase in number once run_command is used for Docker CLI after the Bollard migration).
  • Adjusts the formatting of the panic error messages to improve readability (eg adds some additional whitespace, and adjusts the stdout/stderr order).

This has been split out of the Bollard migration PR to make it easier to review.

GUS-W-13841325.

This:
- Moves `run_pack_command` to `utils` and makes it generic, so it
  can be used when calling other external processes (such as Docker
  CLI, in the upcoming Bollard migration).
- Makes `run_command` return a `Result` instead of panicing directly,
  so that the caller is both in control of the outcome and can add additional
  context to the panic error message.
- Adjusts the formatting of the panic error messages to improve readability
  (eg adds some additional whitespace, and adjusts the stdout/stderr order).

This has been split out of the Bollard migration PR to make it easier to review.
@edmorley edmorley added enhancement New feature or request libcnb-test labels Jul 27, 2023
@edmorley edmorley self-assigned this Jul 27, 2023
@edmorley edmorley marked this pull request as ready for review July 27, 2023 21:44
@edmorley edmorley requested a review from a team as a code owner July 27, 2023 21:44
@edmorley edmorley enabled auto-merge (squash) July 27, 2023 21:45
@edmorley edmorley disabled auto-merge July 27, 2023 21:46
@edmorley edmorley enabled auto-merge (squash) July 27, 2023 21:46
@edmorley edmorley merged commit 346a186 into main Jul 31, 2023
6 checks passed
@edmorley edmorley deleted the edmorley/run_command branch July 31, 2023 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request libcnb-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants