use of com.sun.enterprise.universal.process.ProcessManagerTimeoutException in project Payara by payara.
the class NucleusTestUtils method cmdDetachWithOutput.
public static NadminReturn cmdDetachWithOutput(final File cmd, final int timeout, final String... args) {
List<String> command = new ArrayList<String>();
command.add(cmd.toString());
command.add("--echo");
command.add("--detach");
command.addAll(Arrays.asList(args));
ProcessManager pm = new ProcessManager(command);
// the tests may be running unattended -- don't wait forever!
pm.setTimeoutMsec(timeout);
pm.setEcho(false);
pm.setEnvironment(envp);
int exit;
String myErr = "";
try {
exit = pm.execute();
} catch (ProcessManagerTimeoutException tex) {
myErr = "\nProcessManagerTimeoutException: command timed out after " + timeout + " ms.";
exit = 1;
} catch (ProcessManagerException ex) {
exit = 1;
}
NadminReturn ret = new NadminReturn(exit, pm.getStdout(), pm.getStderr() + myErr, args[0]);
write(ret.outAndErr);
return ret;
}
use of com.sun.enterprise.universal.process.ProcessManagerTimeoutException in project Payara by payara.
the class NucleusTestUtils method cmdWithOutput.
public static NadminReturn cmdWithOutput(final File cmd, final int timeout, final String... args) {
List<String> command = new ArrayList<String>();
command.add(cmd.toString());
command.add("--echo");
command.addAll(Arrays.asList(args));
ProcessManager pm = new ProcessManager(command);
// the tests may be running unattended -- don't wait forever!
pm.setTimeoutMsec(timeout);
pm.setEcho(false);
pm.setEnvironment(envp);
int exit;
String myErr = "";
try {
exit = pm.execute();
} catch (ProcessManagerTimeoutException tex) {
myErr = "\nProcessManagerTimeoutException: command timed out after " + timeout + " ms.";
exit = 1;
} catch (ProcessManagerException ex) {
ex.printStackTrace();
myErr = "\n" + ex.getMessage();
exit = 1;
}
NadminReturn ret = new NadminReturn(exit, pm.getStdout(), pm.getStderr() + myErr, args[0]);
write(ret.outAndErr);
return ret;
}
Aggregations