Search in sources :

Example 6 with ExecHandle

use of org.gradle.process.internal.ExecHandle in project gradle by gradle.

the class DefaultDaemonStarter method startProcess.

private DaemonStartupInfo startProcess(List<String> args, File workingDir, InputStream stdInput) {
    LOGGER.info("Starting daemon process: workingDir = {}, daemonArgs: {}", workingDir, args);
    Timer clock = Timers.startTimer();
    try {
        GFileUtils.mkdirs(workingDir);
        DaemonOutputConsumer outputConsumer = new DaemonOutputConsumer(stdInput);
        ExecHandle handle = new DaemonExecHandleBuilder().build(args, workingDir, outputConsumer);
        handle.start();
        LOGGER.debug("Gradle daemon process is starting. Waiting for the daemon to detach...");
        handle.waitForFinish();
        LOGGER.debug("Gradle daemon process is now detached.");
        return daemonGreeter.parseDaemonOutput(outputConsumer.getProcessOutput());
    } catch (GradleException e) {
        throw e;
    } catch (Exception e) {
        throw new GradleException("Could not start Gradle daemon.", e);
    } finally {
        LOGGER.info("An attempt to start the daemon took {}.", clock.getElapsed());
    }
}
Also used : DaemonOutputConsumer(org.gradle.launcher.daemon.bootstrap.DaemonOutputConsumer) Timer(org.gradle.internal.time.Timer) DaemonExecHandleBuilder(org.gradle.launcher.daemon.DaemonExecHandleBuilder) GradleException(org.gradle.api.GradleException) UncheckedIOException(org.gradle.api.UncheckedIOException) IOException(java.io.IOException) GradleException(org.gradle.api.GradleException) ExecHandle(org.gradle.process.internal.ExecHandle)

Aggregations

ExecHandle (org.gradle.process.internal.ExecHandle)6 ExecResult (org.gradle.process.ExecResult)3 IOException (java.io.IOException)2 UncheckedIOException (org.gradle.api.UncheckedIOException)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 GradleException (org.gradle.api.GradleException)1 SimpleWorkResult (org.gradle.api.internal.tasks.SimpleWorkResult)1 ForkOptions (org.gradle.api.tasks.compile.ForkOptions)1 Address (org.gradle.internal.remote.Address)1 ConnectionAcceptor (org.gradle.internal.remote.ConnectionAcceptor)1 ObjectConnection (org.gradle.internal.remote.ObjectConnection)1 Timer (org.gradle.internal.time.Timer)1 DaemonExecHandleBuilder (org.gradle.launcher.daemon.DaemonExecHandleBuilder)1 DaemonOutputConsumer (org.gradle.launcher.daemon.bootstrap.DaemonOutputConsumer)1 DefaultExecHandleBuilder (org.gradle.process.internal.DefaultExecHandleBuilder)1 ExecHandleBuilder (org.gradle.process.internal.ExecHandleBuilder)1 ExecHandleListener (org.gradle.process.internal.ExecHandleListener)1 JavaExecHandleBuilder (org.gradle.process.internal.JavaExecHandleBuilder)1