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

proposal: testscript: allow to specify wanted exit status #271

Open
marco-m opened this issue Sep 9, 2024 · 0 comments
Open

proposal: testscript: allow to specify wanted exit status #271

marco-m opened this issue Sep 9, 2024 · 0 comments

Comments

@marco-m
Copy link

marco-m commented Sep 9, 2024

Hello,

today testscript allows to require:

  • success (exit status 0) with exec foo
  • failure (exit status != 0) with ! exec foo.

Sometimes one would like to specify the exact exit status value. For example, if curl was written in Go, see section "EXIT CODES" of the curl man page.

I realized that a backward-compatible and clear way to express this would be to add an optional integer to the right of the ! symbol:

  • ! exec foo as of today
  • !<N> exec foo, where <N> is a non-zero, positive integer, to specify the exit status.
    • For example: !2 exec foo requires foo to exit with status 2.

As usual, the proposed syntax is just a possibility, I care more about the feature itself.

Thanks for testscript!

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

No branches or pull requests

1 participant