fix: error when executing the version flag#332
Conversation
|
Great job! No new security vulnerabilities introduced in this pull request |
| if engineInstance == nil { | ||
| return 0, fmt.Errorf("engine was not initialized") | ||
| if engineInstance != nil { | ||
| return engineInstance.GetReport().GetTotalSecretsFound(), nil |
There was a problem hiding this comment.
this line always confused me, are we using this? Because this is the exit code of a command which is supposed to have a particular meaning, but I never knew if we were using for anything.
There was a problem hiding this comment.
Not saying I agree with the current system, but TL;DR: by default, errors add 1 to the exit code, and if 2ms finds at least one result, it adds 2. For example, if 2ms finds at least one secret and an error occurs, it exits with code 3; if no secrets are found and there are no errors, it exits 0; if results are found and there are no errors, it exits 2. We also have a flag to control this behavior "ignore-on-exit": https://github.com/Checkmarx/2ms?tab=readme-ov-file#global-flags








No description provided.