Package com.alphacsp.cit.exec

Examples of com.alphacsp.cit.exec.InteractiveProcess


            throw new RuntimeException(e);
        }
    }

    public static void runInteractiveProcess(Process process, InputStream inputStream, PrintStream printStream) throws ProcessNonZeroExitCodeException {
        final InteractiveProcess interactiveProcess = new InteractiveProcess(process, inputStream, printStream);

        new Thread() {
            public void run() {
                interactiveProcess.connect();
            }
        }.start();

        try {
            int exitCode = interactiveProcess.waitFor();
            if (exitCode != 0) {
                throw new ProcessNonZeroExitCodeException(process, exitCode);
            }
        } catch (InterruptedException e) {
            LOG.info("InterruptedException!, killing the process", e);
            interactiveProcess.destroy();
        } finally {
            interactiveProcess.disconnect();
        }
    }
View Full Code Here

TOP

Related Classes of com.alphacsp.cit.exec.InteractiveProcess

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.