Package org.gradle.process

Examples of org.gradle.process.ExecResult


                System.err,
                new ByteArrayInputStream(new byte[0]),
                Collections.<ExecHandleListener>emptyList()
        );

        ExecResult result = execHandle.start().waitForFinish();
        assertEquals(ExecHandleState.SUCCEEDED, execHandle.getState());
        assertEquals(0, result.getExitValue());
        assertEquals("args: [arg1, arg2]", out.toString());
        result.assertNormalExitValue();
    }
View Full Code Here


                System.err,
                new ByteArrayInputStream(new byte[0]),
                Collections.<ExecHandleListener>emptyList()
        );

        ExecResult result = execHandle.start().waitForFinish();
        assertEquals(ExecHandleState.FAILED, execHandle.getState());
        assertEquals(72, result.getExitValue());
        try {
            result.assertNormalExitValue();
            fail();
        } catch (ExecException e) {
            assertEquals("Display-name finished with non-zero exit value.", e.getMessage());
        }
    }
View Full Code Here

        );

        execHandle.start();
        execHandle.abort();

        ExecResult result = execHandle.waitForFinish();
        assertEquals(ExecHandleState.ABORTED, execHandle.getState());
        assertThat(result.getExitValue(), not(equalTo(0)));
    }
View Full Code Here

            lock.unlock();
        }
    }

    public ExecResult waitForStop() {
        ExecResult result = execHandle.waitForFinish();
        ObjectConnection connection;
        lock.lock();
        try {
            connection = this.connection;
        } finally {
            lock.unlock();
        }
        if (connection != null) {
            connection.stop();
        }
        return result.assertNormalExitValue();
    }
View Full Code Here

                    notifyClientExited( -1, e.getMessage() );
                    setExternalProcess(null);
                    return;
                }

                ExecResult result = execHandle.waitForFinish();
                LOGGER.debug("External process completed with exit code {}", result.getExitValue());

                setExternalProcess(null);   //clear our external process member variable (we're using our local variable below). This is so we know the process has already stopped.

                executionInfo.processExecutionComplete();
                notifyClientExited( result.getExitValue(), output.toString() );
            }
        });

        thread.start();
    }
View Full Code Here

                    notifyClientExited(-1, e.getMessage());
                    setExternalProcess(null);
                    return;
                }

                ExecResult result = execHandle.waitForFinish();
                LOGGER.debug("External process completed with exit code {}", result.getExitValue());

                setExternalProcess(null);   //clear our external process member variable (we're using our local variable below). This is so we know the process has already stopped.

                executionInfo.processExecutionComplete();
                notifyClientExited(result.getExitValue(), output.toString());
            }
        });

        thread.start();
    }
View Full Code Here

        exec.args(args);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        exec.setStandardOutput(baos);
        exec.setErrorOutput(new ByteArrayOutputStream());
        exec.setIgnoreExitValue(true);
        ExecResult result = exec.execute();

        int exitValue = result.getExitValue();
        if (exitValue == 0) {
            return new String(baos.toByteArray());
        } else {
            return null;
        }
View Full Code Here

        super(fileResolver);
    }

    public ExecResult execute() {
        ExecHandle execHandle = build();
        ExecResult execResult = execHandle.start().waitForFinish();
        if (!isIgnoreExitValue()) {
            execResult.assertNormalExitValue();
        }
        return execResult;
    }
View Full Code Here

        super(fileResolver);
    }

    public ExecResult execute() {
        ExecHandle execHandle = build();
        ExecResult execResult = execHandle.start().waitForFinish();
        if (!isIgnoreExitValue()) {
            execResult.assertNormalExitValue();
        }
        return execResult;
    }
View Full Code Here

        return (ExecutionFailure) waitForStop(true);
    }

    protected ExecutionResult waitForStop(boolean expectFailure) {
        ExecHandle execHandle = getExecHandle();
        ExecResult execResult = execHandle.waitForFinish();
        execResult.rethrowFailure(); // nop if all ok

        String output = getStandardOutput();
        String error = getErrorOutput();

        boolean didFail = execResult.getExitValue() != 0;
        if (didFail != expectFailure) {
            String message = String.format("Gradle execution %s in %s with: %s %s%nOutput:%n%s%n-----%nError:%n%s%n-----%n",
                    expectFailure ? "did not fail" : "failed", execHandle.getDirectory(), execHandle.getCommand(), execHandle.getArguments(), output, error);
            throw new UnexpectedBuildFailure(message);
        }
View Full Code Here

TOP

Related Classes of org.gradle.process.ExecResult

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.