Is your feature request related to a problem? Please describe.
When getting the output of a command via the feature introduced in #113, the full output of the command is returned, even if called with --format json or --format simple-json, making the result not parseable as JSON due to several lines of informational output before the JSON-formatted output is returned.
Describe the solution you'd like to see
If --format json or --format simple-json are set, only return the JSON output if returned in a script.
script {
String result = jf 'audit --format json'
def json = new JsonSlurper().parseText(result)
}
Describe alternatives you've considered
No response
Additional context
Current result of trying to parse result as JSON:
09:31:48 [Info] Performing scans on 1 targets:
[
{
"target": "/var/jenkins/workspace/something",
"technology": "maven"
}
]
09:31:48 [Info] Not entitled for JAS, skipping advance security scans...
09:31:48 [Info] Calculating Maven dependencies...
...........
A JSON payload should start with an openning curly brace '{' or an openning square bracket '['.
Instead, '09' was found on line: 1, column: 1
Is your feature request related to a problem? Please describe.
When getting the output of a command via the feature introduced in #113, the full output of the command is returned, even if called with
--format jsonor--format simple-json, making the result not parseable as JSON due to several lines of informational output before the JSON-formatted output is returned.Describe the solution you'd like to see
If
--format jsonor--format simple-jsonare set, only return the JSON output if returned in a script.Describe alternatives you've considered
No response
Additional context
Current result of trying to parse result as JSON: