Exception in JavaScript verticle:
ReferenceError: "runCommand" is not defined.
at file:/Users/mrdavidlaing/Projects/mrdavidlaing/pressupbox-api/mods/pressupbox.gitpull-v0.1.x/gitpull-main.js:54 (anonymous)
at core/event_bus.js:56 (anonymous)
var process = new java.lang.ProcessBuilder("myCommand", "myArg1", "myArg2").start();
My expectation was that I could use Rhino's runCommand() but this fails with:
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/vertx/-/8zVu-_l2uLYJ.
To post to this group, send an email to ve...@googlegroups.com.
To unsubscribe from this group, send email to vertx+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/vertx?hl=en-GB.
commons-exec-1.1.jar in my module's lib/ folder/*
* Execute cmdLine synchronously from workingDirectory.
* Will kill cmdLine of runs for more than timeoutInMs milliseconds
* Returns { exitValue: <cmdLine exit value>, output: <what was written to stdOut + stdErr by cmdLine> }
*
* Requires: lib/commons-exec-1.1.jar (http://commons.apache.org/exec/)
*/
function runCommand(command, workingDirectory, timeoutInMs) {
var executor = new org.apache.commons.exec.DefaultExecutor();
var cmdLine = org.apache.commons.exec.CommandLine.parse(command);
executor.setWorkingDirectory(new java.io.File(workingDirectory));
var watchdog = new org.apache.commons.exec.ExecuteWatchdog(timeoutInMs);
executor.setWatchdog(watchdog);
var outputStream = new java.io.ByteArrayOutputStream();
var streamHandler = new org.apache.commons.exec.PumpStreamHandler(outputStream);
executor.setStreamHandler(streamHandler);
var exitValue = executor.execute(cmdLine);
return { "exitValue": exitValue, "output": outputStream.toString() };
}