private Process createProcess ( final File sourceFile , final File destFile ) throws IOException { notNull ( sourceFile ) ; final String [ ] commandLine = getCommandLine ( sourceFile . getPath ( ) , destFile . getPath ( ) ) ; LOG . debug ( "CommandLine arguments: {}" , Arrays . asList ( commandLine ) ) ; final Process process = new ProcessBuilder ( commandLine ) . redirectErrorStream ( true ) . start ( ) ; //Gobblers responsible for reading stream to avoid blocking of the process when the buffer is full. final StreamGobbler errorGobbler = new StreamGobbler ( process . getErrorStream ( ) , "ERROR" ) ; // any output? final StreamGobbler outputGobbler = new StreamGobbler ( process . getInputStream ( ) , "OUTPUT" ) ; // kick them off errorGobbler . start ( ) ; outputGobbler . start ( ) ; return process ; }
Creates process responsible for running tsc shell command by reading the file content from the sourceFilePath