Skip to content

Properly return a 1 when a threshold is not met - #3299

Merged
em-c-rod merged 3 commits into
mainfrom
return_code
Feb 19, 2025
Merged

em-c-rod merged 3 commits into
mainfrom
return_code

Conversation

@wdower

@wdower wdower commented Feb 18, 2025

Copy link
Copy Markdown
Contributor

SAF CLI should exit with code 1 when a threshold is not met to enable other automation to properly handle its output without having to parse stderr.

Resolves #3298

@wdower wdower self-assigned this Feb 18, 2025
@sonarqubecloud

Copy link
Copy Markdown

} else {
this.warn(err)
console.error(err.message)
process.exit(1)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We tried using this.exit instead of process but it dumped the entire stack trace. What we want is a simple error message to stderr and the return code set correctly. Working within oclif doesn't seem to want to allow this.

@wdower
wdower marked this pull request as ready for review February 19, 2025 18:32

@georgedias georgedias left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Until we hear from oclif I support using this work-around

@em-c-rod
em-c-rod merged commit 09065ec into main Feb 19, 2025
@em-c-rod
em-c-rod deleted the return_code branch February 19, 2025 20:45
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

Successfully merging this pull request may close these issues.

validate threshold does not properly exit with return code 1 when the threshold is not met

3 participants