-
Notifications
You must be signed in to change notification settings - Fork 530
feat: Allow process_wrapper to capture exit codes instead of forwarding them #3772
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
base: main
Are you sure you want to change the base?
Conversation
| args.process_wrapper_flags.add("--touch-file", success_marker) | ||
| outputs.append(success_marker) | ||
|
|
||
| if forward_clippy_exit_code == False: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simpler: would a user ever need to set one option but not the other? If there's an exit code file, then capture, otherwise forward
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about it, but I'm not convinced it's the right approach. Because this is the process wrapper so it can be used for anything, I can see someone wanting to ignore non-zero exit values but not wanting to declare a file, e.g. if we 'bazel run'.
I agree that this is not a real use case right now, so I could definitely be convinced to collapse the arguments.
illicitonion
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me! I'd be tempted to name the flag --swallow-exit-code or --exit-0 so that it defaults false rather than defaulting true, but I'm not super picky about it...
beff69b to
225f8fc
Compare
|
@illicitonion I've renamed the flag as Splitting hairs? Probably. Now to make CI pass. |
c8073d4 to
5f13335
Compare
|
I'm not sure what's up with CI, but the remaining failures don't seem to be related to this PR. Locally, |
|
I was wondering. Why can't |
I think the main reason might be the same as this PR honestly. Without this PR, I'm not sure how we could capture the errors from clippy for post-processing without failing the entire action. If I understand correctly, right now
The other reason is less important and related to |
Why do you need to swallow the error code? I'm also not sure I follow the rationale for why |
@UebelAndre That's fair, I'm happy to step back and discuss the core problem to see if there's a better solution :) In fact, let's ignore "spawning an action from a different ruleset" for now, as I think this PR still has purpose outside of it. I can open a separate issue to discuss how to work with rules_lint in the grand scheme of things. The main problem this PR tries to solve: There is no way for me to, at the same time:
This is because rules_rust enforces that "if you're capturing output, you must pass blorente/bzl-repros#1 is a minimal repro of the problem. If I run I'm not sold on this exact interface being the right solution, but I do think that preserving the warnings and errors does require teaching the process wrapper to not fail when the child process fails. A secondary problem that this PR tries to solve is "there is no way for me to know the exit code of clippy". Right now, Having this information would be useful but not vital, so this problem has lower priority than the one above. I'm happy to split the solution to this problem to another PR. |
Draft implementation of #3771
I'll add tests once the maintainers have confirmed that this behaviour is wanted.