-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Exit when calling root command with unrecognized option
#8868
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
Conversation
|
Starting build on |
|
Build failed on ROOT-performance-centos8-multicore/default. Failing tests: |
|
Build failed on ROOT-ubuntu16/nortcxxmod. Failing tests: |
|
Build failed on ROOT-debian10-i386/cxx14. Failing tests: |
|
Build failed on mac11.0/cxx17. Failing tests: |
|
Build failed on mac1014/python3. Failing tests: |
|
Build failed on windows10/cxx14. Failing tests: |
|
Starting build on |
|
Errors above were due to some options unrecognized by Also changed to using |
|
Starting build on |
|
Build failed on mac11.0/cxx17. Failing tests: |
Options passed to the `root` command are parsed in `TApplication::GetOptions(Int_t *argc, char **argv)`. String options in `argv` are removed from the array of options after parsing. If any string remains in argv, it means it is not recognized by the `root` command. While these could still be useful for other `TApplication` instances, in the specific case of calling `root` which is based on `TRint` it simply means the remaining options are not valid. This commit introduces an early exit logic in the constructor of `TRint`. If there are any remaining unrecognized options as described above, they will be printed to `std::cerr` and then ROOT will terminate execution, similar to other linux commands: ``` $: root -z --nonexistingoption root: unrecognized option '-z' root: unrecognized option '--nonexistingoption' Try 'root --help' for more information. ```
9cf454e to
e0de156
Compare
|
Starting build on |
|
Build failed on ROOT-performance-centos8-multicore/default. Errors:
Failing tests: |
|
Build failed on mac11.0/cxx17. Errors:
Failing tests: |
|
@eguiraud @Axel-Naumann if you're ok with this PR it is ready to be merged 👍 |
eguiraud
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.
LGTM although i'm not the code owner 😄
e0de156 to
03106b9
Compare
|
Starting build on |
|
Build failed on mac11.0/cxx17. Failing tests: |
|
Build failed on windows10/cxx14. Failing tests: |
Fixes #8850
May still need polishing, will add test if logic is approved.
With this commit, when
rootreceives an unrecognized options it prints an error (similar to other linux commands errors) and exits before showing the prompt.