public ProcResult run ( ) throws StartupException , TimeoutException , ExternalProcessFailureException { if ( stdout != defaultStdout && outputConsumer != null ) { throw new IllegalArgumentException ( "You can either ..." ) ; } try { Proc proc = new Proc ( command , args , env , stdin , outputConsumer != null ? outputConsumer : stdout , directory , timoutMillis , expectedExitStatuses , stderr ) ; return new ProcResult ( proc . toString ( ) , defaultStdout == stdout && outputConsumer == null ? defaultStdout : null , proc . getExitValue ( ) , proc . getExecutionTime ( ) , proc . getErrorBytes ( ) ) ; } finally { stdout = defaultStdout = new ByteArrayOutputStream ( ) ; stdin = null ; } }
Spawn the actual execution . This will block until the process terminates .