417574 Setting options with _JAVA_OPTIONS breaks run-forked with <waitForChild>true</waitForChild>

This commit is contained in:
Jan Bartel 2013-09-30 12:23:14 +10:00
parent 8d312b9e5d
commit cb554948a2
1 changed files with 5 additions and 3 deletions

View File

@ -709,19 +709,20 @@ public class JettyRunForkedMojo extends AbstractMojo
if (PluginLog.getLog().isDebugEnabled()) if (PluginLog.getLog().isDebugEnabled())
PluginLog.getLog().debug(Arrays.toString(cmd.toArray())); PluginLog.getLog().debug(Arrays.toString(cmd.toArray()));
forkedProcess = builder.start();
PluginLog.getLog().info("Forked process starting"); PluginLog.getLog().info("Forked process starting");
if (waitForChild) if (waitForChild)
{ {
forkedProcess = builder.start();
startPump("STDOUT",forkedProcess.getInputStream()); startPump("STDOUT",forkedProcess.getInputStream());
startPump("STDERR",forkedProcess.getErrorStream()); startPump("STDERR",forkedProcess.getErrorStream());
int exitcode = forkedProcess.waitFor(); int exitcode = forkedProcess.waitFor();
PluginLog.getLog().info("Forked execution exit: "+exitcode); PluginLog.getLog().info("Forked execution exit: "+exitcode);
} }
else else
{ //we're not going to be reading the stderr as we're not waiting for the child to finish { //merge stderr and stdout from child
forkedProcess.getErrorStream().close(); builder.redirectErrorStream(true);
forkedProcess = builder.start();
//wait for the child to be ready before terminating. //wait for the child to be ready before terminating.
//child indicates it has finished starting by printing on stdout the token passed to it //child indicates it has finished starting by printing on stdout the token passed to it
@ -754,6 +755,7 @@ public class JettyRunForkedMojo extends AbstractMojo
{ {
throw new MojoExecutionException ("Problem determining if forked process is ready: "+e.getMessage()); throw new MojoExecutionException ("Problem determining if forked process is ready: "+e.getMessage());
} }
} }
} }
catch (InterruptedException ex) catch (InterruptedException ex)