commit | 4b1e9832ff4d051e9dbd42f2c9e6b17f2b324167 | [log] [tgz] |
---|---|---|
author | Oliver Newman <olivernewman@google.com> | Mon Jun 12 13:54:11 2023 +0000 |
committer | CQ Bot <fuchsia-internal-scoped@luci-project-accounts.iam.gserviceaccount.com> | Mon Jun 12 13:54:11 2023 +0000 |
tree | 90a1d44f37a78a54699d93fe3da718640b0656e9 | |
parent | e5a84f6ffb9586a12a7d6cee5f02a34d4d0f69a3 [diff] |
[engine] Add ok_retcodes param to ctx.os.exec This helps reduce boilerplate when handling exec'd subprocesses that have multiple exit codes that are considered non-fatal. Before: res = ctx.os.exec(["foo"], raise_on_failure = False).wait() if res.retcode not in [0, 1]: fail("foo returned unexpected retcode %d", res.retcode) After: res = ctx.os.exec(["foo"], ok_retcodes = [0, 1]).wait() We continue to support `raise_on_failure` for backwards compatibility, and for any command where no exit codes should be considered fatal. This was inspired by the `ok_ret` parameter to the recipe engine's `api.step()` command: https://chromium.googlesource.com/infra/luci/recipes-py/+/a72ad3ee2f4bc2f63f120a0ab4007afc1824feb6/recipe_modules/step/api.py#621 Change-Id: I31c41c8690f6078af939cab6ee0b24cb701a68d2 Reviewed-on: https://fuchsia-review.googlesource.com/c/shac-project/shac/+/869417 Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com> Fuchsia-Auto-Submit: Oliver Newman <olivernewman@google.com> Reviewed-by: Marc-Antoine Ruel <maruel@google.com>
Shac (Scalable Hermetic Analysis and Checks) is a unified and ergonomic tool and framework for writing and running static analysis checks.
Shac checks are written in Starlark.
go install go.fuchsia.dev/shac-project/shac@latest shac check shac doc shac.star | less
⚠ The source of truth is at https://fuchsia.googlesource.com/shac-project/shac.git and uses Gerrit for code review.
See CONTRIBUTING.md to submit changes.