summaryrefslogtreecommitdiffstats
path: root/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/process/ChildProcess.java
blob: 71a4c7c109b06343da60400c80bfd8a6568b9c4e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.node.admin.task.util.process;

import java.nio.file.Path;
import java.util.logging.Logger;

/**
 * @author hakonhall
 */
public interface ChildProcess extends AutoCloseable {
    String commandLine();
    ChildProcess waitForTermination();
    int exitValue();
    ChildProcess throwIfFailed();
    String getUtf8Output();

    /**
     * Only call this if process was spawned under the assumption the program had no side
     * effects (see Command::spawnProgramWithoutSideEffects).  If it is determined later
     * that the program did in fact have side effects (modified system), this method can
     * be used to log that fact. Alternatively, call TaskContext::logSystemModification
     * directly.
     */
    void logAsModifyingSystemAfterAll(Logger logger);

    @Override
    void close();

    // For testing only
    Path getProcessOutputPath();
}