In declarative pipeline, I want to capture the return code from my application. I understand I can do this using sh returnStatus, for example:
results[nextFile] = sh returnStatus: true, script: "./myApp $nextFile"
but I also need to prefix the application call with a few other shell commands:
sh """ umask 007 export TARGET_ROOT=$target_path ./myApp $nextFile """
How can I use returnStatus to get the return code of the last command (./myApp) in this case please?