outputPumper = new StreamPumper( p.getInputStream(), systemOut ); outputPumper.start(); errorPumper = new StreamPumper( p.getErrorStream(), systemErr ); errorPumper.start(); outputPumper.waitUntilDone(); errorPumper.waitUntilDone(); outputPumper.close(); handleException( outputPumper, "stdout" ); errorPumper.close(); handleException( errorPumper, "stderr" ); outputPumper.disable(); errorPumper.disable(); outputPumper.close(); errorPumper.close();
outPumper = new StreamPumper( p.getInputStream(), out ); errPumper = new StreamPumper( p.getErrorStream(), out ); outPumper.setPriority( Thread.MIN_PRIORITY + 1 ); errPumper.setPriority( Thread.MIN_PRIORITY + 1 ); outPumper.start(); errPumper.start(); outPumper.close(); errPumper.close();
private void redirectOutput(Process process, Log logger) { StreamToLogConsumer logConsumer = logger::info; StreamPumper outPumper = new StreamPumper(process.getInputStream(), logConsumer); StreamPumper errPumper = new StreamPumper(process.getErrorStream(), logConsumer); outPumper.setPriority(Thread.MIN_PRIORITY + 1); errPumper.setPriority(Thread.MIN_PRIORITY + 1); outPumper.start(); errPumper.start(); }
private void runFlashplayer( String asvmCommand[], String targetFile ) throws LaunchFlashPlayerException { getLogger().debug( "[LAUNCHER] Using regular flashplayer tests" ); try { final String[] cmdArray = merge( asvmCommand, new String[] { targetFile } ); getLogger().debug( "[LAUNCHER] Executing command: " + Arrays.toString( cmdArray ) ); process = Runtime.getRuntime().exec( cmdArray ); new StreamPumper( process.getInputStream(), new ConsoleConsumer( "[SYSOUT]: " ) ).start(); new StreamPumper( process.getErrorStream(), new ConsoleConsumer( "[SYSERR]: " ) ).start(); } catch ( IOException e ) { throw new LaunchFlashPlayerException( "Failed to launch runtime (executable file name: '" + asvmCommand[0] + "').", e ); } }
outPumper = new StreamPumper( p.getInputStream(), out ); errPumper = new StreamPumper( p.getErrorStream(), out ); outPumper.setPriority( Thread.MIN_PRIORITY + 1 ); errPumper.setPriority( Thread.MIN_PRIORITY + 1 ); outPumper.start(); errPumper.start(); outPumper.close(); errPumper.close();
private void executeCommandLine( Commandline cli ) throws AppBooterServiceException { Process p = null; if ( streamConsumer == null ) { streamConsumer = new StreamConsumer() { public void consumeLine( String line ) { getLogger().info( line ); } }; } try { p = cli.execute(); outPumper = new StreamPumper( p.getInputStream(), streamConsumer ); errPumper = new StreamPumper( p.getErrorStream(), streamConsumer ); outPumper.setPriority( Thread.MIN_PRIORITY + 1 ); errPumper.setPriority( Thread.MIN_PRIORITY + 1 ); outPumper.start(); errPumper.start(); } catch ( CommandLineException e ) { throw new AppBooterServiceException( "Failed to execute plexus application: " + e.getMessage(), e ); } }
public void run() { status = ThreadStatus.RUNNING; new StreamPumper( process.getInputStream(), new ConsoleConsumer( "[SYSOUT]: " ) ).start(); new StreamPumper( process.getErrorStream(), new ConsoleConsumer( "[SYSERR]: " ) ).start(); getLogger().debug( "[LAUNCHER] Output pumpers ON" ); try { getLogger().debug( "[LAUNCHER] Waiting for flashplayer termination" ); int returnCode = process.waitFor(); getLogger().debug( "[LAUNCHER] Flashplayer closed" ); processExitCode( returnCode ); return; } catch ( InterruptedException e ) { getLogger().debug( "[LAUNCHER] Process run error: " + e.getMessage() ); status = ThreadStatus.ERROR; error = new Error( "Error while executing external command, process killed.", e ); } }
private void executeCommandLine( Commandline cli ) throws AppBooterServiceException { Process p = null; if ( streamConsumer == null ) { streamConsumer = new StreamConsumer() { public void consumeLine( String line ) { getLogger().info( line ); } }; } try { p = cli.execute(); outPumper = new StreamPumper( p.getInputStream(), streamConsumer ); errPumper = new StreamPumper( p.getErrorStream(), streamConsumer ); outPumper.setPriority( Thread.MIN_PRIORITY + 1 ); errPumper.setPriority( Thread.MIN_PRIORITY + 1 ); outPumper.start(); errPumper.start(); } catch ( CommandLineException e ) { throw new AppBooterServiceException( "Failed to execute plexus application: " + e.getMessage(), e ); } }