Package jetbrains.buildServer
Class CommandLineExecutor
- java.lang.Object
-
- jetbrains.buildServer.CommandLineExecutor
-
public class CommandLineExecutor extends Object
-
-
Constructor Summary
Constructors Constructor Description CommandLineExecutor(GeneralCommandLine commandLine)
CommandLineExecutor(GeneralCommandLine commandLine, boolean useProcessTreeTerminator)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
destroyProcess()
void
destroyProcess(boolean destroyProcessTree)
static void
finalizeAll(Process proc, StreamGobbler errorGobbler, StreamGobbler outputGobbler)
OutputStream
getOutputStream()
Process
getProcess()
static int
getTimeOutValue()
ExecResult
runProcess()
ExecResult
runProcess(byte[] processInput, int idleTimeout)
ExecResult
runProcess(byte[] processInput, int idleTimeout, ByteArrayOutputStream stdoutBuffer, ByteArrayOutputStream stderrBuffer)
ExecResult
runProcess(int executionTimeoutSeconds)
ExecResult
runProcess(int executionTimeoutSeconds, int idleTimeoutSeconds)
Runs the command in a new process, waits for the process to finish and returns its results.ExecResult
waitFor()
static int
waitForProcess(Process proc, String actionDetails, StreamGobbler errorGobbler, StreamGobbler outputGobbler)
static int
waitForProcess(Process proc, String actionDetails, StreamGobbler errorGobbler, StreamGobbler outputGobbler, int idleTimeoutSeconds)
static int
waitForProcess(Process proc, String actionDetails, StreamGobbler errorGobbler, StreamGobbler outputGobbler, int idleTimeoutSeconds, boolean destroyProcessTreeOnExit)
static int
waitForProcess(Process proc, StreamGobbler errorGobbler, StreamGobbler outputGobbler)
Deprecated.use the method with actionDetails parameter to specify context to logstatic int
waitForProcess(Process proc, StreamGobbler errorGobbler, StreamGobbler outputGobbler, int idleTimeoutSeconds)
Deprecated.use the method with actionDetails parameter to specify context to log
-
-
-
Constructor Detail
-
CommandLineExecutor
public CommandLineExecutor(@NotNull GeneralCommandLine commandLine)
-
CommandLineExecutor
public CommandLineExecutor(@NotNull GeneralCommandLine commandLine, boolean useProcessTreeTerminator)
-
-
Method Detail
-
getTimeOutValue
public static int getTimeOutValue()
-
runProcess
@Nullable public ExecResult runProcess(int executionTimeoutSeconds) throws ExecutionException
- Throws:
ExecutionException
-
runProcess
@Nullable public ExecResult runProcess(int executionTimeoutSeconds, int idleTimeoutSeconds) throws ExecutionException
Runs the command in a new process, waits for the process to finish and returns its results.- Parameters:
executionTimeoutSeconds
- the maximum number of seconds of waiting for the process to finishidleTimeoutSeconds
- the maximum number of seconds of waiting for any new output in stdout and stderr. In case there is no output in this timeframe the process is considered as idle and the execution is interrupted- Throws:
ExecutionException
- Since:
- 2024.03.3
-
runProcess
@NotNull public ExecResult runProcess() throws ExecutionException
- Throws:
ExecutionException
-
runProcess
@NotNull public ExecResult runProcess(@Nullable byte[] processInput, int idleTimeout) throws ExecutionException
- Throws:
ExecutionException
- Since:
- 2019.2
-
finalizeAll
public static void finalizeAll(Process proc, StreamGobbler errorGobbler, StreamGobbler outputGobbler) throws InterruptedException
- Throws:
InterruptedException
-
getOutputStream
public OutputStream getOutputStream()
-
waitForProcess
public static int waitForProcess(Process proc, String actionDetails, StreamGobbler errorGobbler, StreamGobbler outputGobbler, int idleTimeoutSeconds) throws InterruptedException
- Throws:
InterruptedException
- Since:
- 2018.1
-
getProcess
public Process getProcess()
-
waitForProcess
public static int waitForProcess(Process proc, String actionDetails, StreamGobbler errorGobbler, StreamGobbler outputGobbler, int idleTimeoutSeconds, boolean destroyProcessTreeOnExit) throws InterruptedException
- Throws:
InterruptedException
-
runProcess
@NotNull public ExecResult runProcess(@Nullable byte[] processInput, int idleTimeout, @NotNull ByteArrayOutputStream stdoutBuffer, @NotNull ByteArrayOutputStream stderrBuffer) throws ExecutionException
- Throws:
ExecutionException
- Since:
- 2019.2
-
waitForProcess
public static int waitForProcess(Process proc, StreamGobbler errorGobbler, StreamGobbler outputGobbler) throws InterruptedException
Deprecated.use the method with actionDetails parameter to specify context to log- Throws:
InterruptedException
-
waitForProcess
public static int waitForProcess(Process proc, String actionDetails, StreamGobbler errorGobbler, StreamGobbler outputGobbler) throws InterruptedException
- Throws:
InterruptedException
- Since:
- 2018.1
-
waitForProcess
public static int waitForProcess(Process proc, StreamGobbler errorGobbler, StreamGobbler outputGobbler, int idleTimeoutSeconds) throws InterruptedException
Deprecated.use the method with actionDetails parameter to specify context to log- Throws:
InterruptedException
-
waitFor
@NotNull public ExecResult waitFor()
-
destroyProcess
public void destroyProcess()
-
destroyProcess
public void destroyProcess(boolean destroyProcessTree)
-
-