When experiencing networking problems on client machines, I\'d like to be able to run a few command lines and email the results of them to myself.
I\'ve found Runtim
Use Plexus Utils, it is used by Maven to execut all external processes.
Commandline commandLine = new Commandline();
commandLine.setExecutable(executable.getAbsolutePath());
Collection args = getArguments();
for (String arg : args) {
Arg _arg = commandLine.createArg();
_arg.setValue(arg);
}
WriterStreamConsumer systemOut = new WriterStreamConsumer(console);
WriterStreamConsumer systemErr = new WriterStreamConsumer(console);
returnCode = CommandLineUtils.executeCommandLine(commandLine, systemOut, systemErr, 10);
if (returnCode != 0) {
// bad
} else {
// good
}