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

[idea] ignore errors / idempotency #721

Open
agardnerIT opened this issue Dec 22, 2024 · 2 comments
Open

[idea] ignore errors / idempotency #721

agardnerIT opened this issue Dec 22, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@agardnerIT
Copy link

Is it possible to runme run --filename test.md in an idempotent manner?

Imagine the first command was a "set something up". The first time, it would run OK. However for subsequent runs, that first command would output errors that I'd like to ignore (because the hypothetical subsequent commands would still be valid).

@sourishkrout
Copy link
Member

sourishkrout commented Dec 23, 2024

There are ways to make the experience better. However, unless you use a devcontainer with all the prerequisites, Runme executing Shell can't know "how valid" the runtime environment is. It's not different from a terminal session.

I can think of several enhancements to improve the status quo. None of which are mutually exclusive.

1. Ignoring errors on the command level

I have used command snippets such as below "successfully" in the past. Essentially, this will turn any non-zero into a zero exit code. It's not ideal because it masks even valid issues. It's a binary choice between erring on false positives or false negatives. Needless to say, this is available now.

$ brew install cmake || true
$ apt install cmake || true

2. Toggleable "set -o pipefail" like behavior with a setting

The idea here would be to define, e.g., on the markdown document level, if errors should bail execution or continue on similarly whether all executed cells are conjoined with OR or AND. Runme does not have this setting yet.

E.g. in the document's frontmatter:
---
pipefail: false
---

3. Define denied / accepted error states per cell

It's not inconceivable to define a list of exit codes that are accepted or denied. For example, 127 usually means a command/executable wasn't found. Similarly, it'd be possible to use substrings of error messages to do the same.

For illustration:

brew install cmake
apt install cmake

What are your thoughts, @agardnerIT?

@sourishkrout sourishkrout added the enhancement New feature or request label Dec 23, 2024
@agardnerIT
Copy link
Author

I think option 2 makes sense. But IMO I'd call it something more obvious like ignore_errors (following Ansible's example)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants