| 1 |
define([], function() { |
| 2 |
return { |
| 3 |
cwd:function() { |
| 4 |
return environment["user.dir"]; |
| 5 |
}, |
| 6 |
|
| 7 |
exit:function(resultCode) { |
| 8 |
|
| 9 |
if (resultCode) { |
| 10 |
java.lang.System.exit(resultCode); |
| 11 |
} |
| 12 |
quit(); |
| 13 |
}, |
| 14 |
|
| 15 |
exec:function() { |
| 16 |
|
| 17 |
for(var args = [], i = 0; i<arguments.length-3; i++){ |
| 18 |
args.push(arguments[i]); |
| 19 |
} |
| 20 |
var |
| 21 |
errorMessage = arguments[i++], |
| 22 |
bc = arguments[i++], |
| 23 |
callback = arguments[i], |
| 24 |
options = {output:""}; |
| 25 |
args.push(options); |
| 26 |
try{ |
| 27 |
runCommand.apply(this, args); |
| 28 |
callback && callback(0, options.output); |
| 29 |
}catch(e){ |
| 30 |
bc.log("execFailed", ["message", errorMessage, "output", options.output+"", "error", e]); |
| 31 |
callback && callback(-1, errorMessage + "\n" + options.output + "\n" + e); |
| 32 |
} |
| 33 |
} |
| 34 |
}; |
| 35 |
}); |