-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Allow --pre to return warning / error output while still searching #1612
Comments
I think this is probably okay, mostly because the preprocessor is likely to be a specific script written by a user, so giving significance to a particular exit status seems okay. Using 125 like It would be good to double check that 125 isn't reserved on Windows for something as well. |
One more thing that I just thought about: It's not clear how multiplexing with stderr should work. In general the user would probably expect the stderr output to be mixed in the stdout output, or specifically if the preprocessor script prints a warning before outputting any data, the user might want that that to appear before the search results for that file in rg as well. This wouldn't be possible to do with my above suggested solution of course.. So an alternative solution might be to add a flag like |
ripgrep works by just gobbling stderr into memory, asynchronously. I'd prefer to keep it that way and would rather not add more flags for tweaking this sort of behavior. It's unfortunate, but if an end user needs to debug their preprocessor, then they should be able to isolate the specific file it's failing on and run their preprocessor directly on that. |
Ok. My first suggestion should be fine for me I think. I'll do a PR when I have time. Regarding, Windows, I coulnd't find anything about defined process exit codes, e.g.:
(https://docs.microsoft.com/en-us/dotnet/api/system.environment.exitcode?view=netcore-3.1) |
Currently, there's only two possibilities:
It would be helpful if there was a third possibility:
This would be useful if the preprocessor command wants to show warnings about not (fully) being able to parse the file or possible other issues, which still outputting data that will probably be helpful to the user.
This should be easy to implement, since the functionality needed pretty much already exists. I can probably also send a PR if you approve.
Regarding which exit status code: It looks like there's only a few "reserved" status codes
The only semi-related example I can think of for chosing an error code is git bisect run:
The text was updated successfully, but these errors were encountered: