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 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 ); } }
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 ); } }
errPumper = new StreamPumper( p.getErrorStream(), out ); outPumper.setPriority( Thread.MIN_PRIORITY + 1 ); errPumper.setPriority( Thread.MIN_PRIORITY + 1 );
errPumper = new StreamPumper( p.getErrorStream(), out ); outPumper.setPriority( Thread.MIN_PRIORITY + 1 ); errPumper.setPriority( Thread.MIN_PRIORITY + 1 );