I want to switch (via "switch.variable") application process into 3 different way, based on results returned of component process. Component process contain shell (bash) script which can return strings as follow:
- some text DIFF some text
- some text NO_DIFF some text
- any text, most likely error message
Then in the same component process I want to process re results of bash script using post-script as follow:
if (properties.get("exitCode") != 0) {
properties.put('Status', 'Failure');
properties.remove("switch.variable")
commandOut.println("Error")
} else {
properties.put('Status', 'Success');
scanner.register("any text", function (lineNumber, line) {
if (line.contains("DIFF")) {
properties.put("switch.variable", "DIFF")
} else if (line.contains("NO_DIFF")) {
properties.put("switch.variable", "NO_DIFF")
}
commandOut.println(properties.get("switch.variable"));
});
scanner.scan();
}
Could you help me to write proper post-script?