Package org.gradle.util

Examples of org.gradle.util.DisconnectableInputStream


        int exitCode;
        try {
            ExecOutputHandleRunner standardOutputRunner;
            ExecOutputHandleRunner errorOutputRunner;
            ExecOutputHandleRunner standardInputRunner;
            InputStream instr = new DisconnectableInputStream(execHandle.getStandardInput(), new DefaultExecutorFactory());
            Process process;

            // This big fat static lock is here for windows. When starting multiple processes concurrently, the stdout
            // and stderr streams for some of the processes get stuck
            synchronized (START_LOCK) {
                process = processBuilder.start();

                standardOutputRunner = new ExecOutputHandleRunner("read process standard output",
                        process.getInputStream(), execHandle.getStandardOutput());
                errorOutputRunner = new ExecOutputHandleRunner("read process error output", process.getErrorStream(),
                        execHandle.getErrorOutput());
                standardInputRunner = new ExecOutputHandleRunner("write process standard input",
                        instr, process.getOutputStream());
            }
            synchronized (lock) {
                this.process = process;
            }

            threadPool.execute(standardInputRunner);
            threadPool.execute(standardOutputRunner);
            threadPool.execute(errorOutputRunner);

            execHandle.started();

            exitCode = process.waitFor();
            instr.close();
        } catch (Throwable t) {
            execHandle.failed(t);
            return;
        }
View Full Code Here


        /*
            There's a potential problem here in that DisconnectableInputStream reads from input in the background.
            This won't automatically stop when the process is over. Therefore, if input is not closed then this thread
            will run forever. It would be better to ensure that this thread stops when the process does.
         */
        InputStream instr = new DisconnectableInputStream(input);

        standardOutputRunner = new ExecOutputHandleRunner("read standard output of: " + processName,
                process.getInputStream(), standardOutput);
        errorOutputRunner = new ExecOutputHandleRunner("read error output of: " + processName, process.getErrorStream(),
                errorOutput);
View Full Code Here

        try {
            if (started) {
                throw new IllegalStateException("input forwarder has already been started");
            }

            disconnectableInput = new DisconnectableInputStream(input, bufferSize);
            outputBuffer = new LineBufferingOutputStream(handler, bufferSize);

            forwardingExecuter = executorFactory.create("forward input");
            forwardingExecuter.execute(new Runnable() {
                public void run() {
View Full Code Here

TOP

Related Classes of org.gradle.util.DisconnectableInputStream

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.