* TODO: Avoid this horrific hack. Discover how to get SCP task to preserve the execute bit.
*/
if (!"windows".equalsIgnoreCase(node.getOsFamily())) {
//perform chmod+x for the file
final NodeExecutorResult nodeExecutorResult = framework.getExecutionService().executeCommand(
context, ExecArgList.fromStrings(false, "chmod", "+x", filepath), node);
if (!nodeExecutorResult.isSuccess()) {
return nodeExecutorResult;
}
}
//build arg list to execute the script
ExecArgList scriptArgList = ScriptExecUtil.createScriptArgList(
filepath,
null,
args,
scriptInterpreter,
interpreterargsquoted
);
NodeExecutorResult nodeExecutorResult = framework.getExecutionService().executeCommand(context,
scriptArgList, node);
if (removeFile) {
//remove file
final NodeExecutorResult nodeExecutorResult2 = framework.getExecutionService().executeCommand(
context, removeArgsForOsFamily(filepath, node.getOsFamily()), node);
if (!nodeExecutorResult2.isSuccess()) {
if (null != context.getExecutionListener()) {
context.getExecutionListener().log(1, "Failed to remove remote file: " + filepath);
}
}
}