Class ExecHelper
- java.lang.Object
-
- com.redhat.devtools.intellij.common.utils.ExecHelper
-
public class ExecHelper extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classExecHelper.ExecResult
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidattachProcessToTerminal(com.intellij.execution.ui.ConsoleView terminalExecutionConsole, com.pty4j.PtyProcess p, boolean waitForProcessExit, java.util.function.Function<ProcessHandlerInput,ExecProcessHandler> processHandlerFunction, com.intellij.execution.process.ProcessListener processListener, java.lang.String... command)static CommonTerminalExecutionConsolecreateTerminalTabForReuse(com.intellij.openapi.project.Project project, java.lang.String title)static java.lang.Stringexecute(java.lang.String executable, boolean checkExitCode, java.io.File workingDirectory, java.util.Map<java.lang.String,java.lang.String> envs, com.intellij.execution.process.ProcessListener listener, java.lang.String... arguments)This method combine out and err outputs in result string, if you need to have them separately use @linkexecuteWithResult(String, boolean, File, Map, String...)static java.lang.Stringexecute(java.lang.String executable, boolean checkExitCode, java.io.File workingDirectory, java.util.Map<java.lang.String,java.lang.String> envs, java.lang.String... arguments)This method combine out and err outputs in result string, if you need to have them separately use @linkexecuteWithResult(String, boolean, File, Map, String...)static java.lang.Stringexecute(java.lang.String executable, boolean checkExitCode, java.lang.String... arguments)This method combine out and err outputs in result string, if you need to have them separately use @linkexecuteWithResult(String, boolean, File, Map, String...)static java.lang.Stringexecute(java.lang.String executable, boolean checkExitCode, java.util.Map<java.lang.String,java.lang.String> envs, java.lang.String... arguments)This method combine out and err outputs in result string, if you need to have them separately use @linkexecuteWithResult(String, boolean, File, Map, String...)static java.lang.Stringexecute(java.lang.String executable, java.io.File workingDirectory, java.lang.String... arguments)This method combine out and err outputs in result string, if you need to have them separately use @linkexecuteWithResult(String, boolean, File, Map, String...)static java.lang.Stringexecute(java.lang.String executable, java.io.File workingDirectory, java.util.Map<java.lang.String,java.lang.String> envs, java.lang.String... arguments)This method combine out and err outputs in result string, if you need to have them separately use @linkexecuteWithResult(String, boolean, File, Map, String...)static java.lang.Stringexecute(java.lang.String executable, java.lang.String... arguments)This method combine out and err outputs in result string, if you need to have them separately use @linkexecuteWithResult(String, boolean, File, Map, String...)static java.lang.Stringexecute(java.lang.String executable, java.util.Map<java.lang.String,java.lang.String> envs, java.lang.String... arguments)This method combine out and err outputs in result string, if you need to have them separately use @linkexecuteWithResult(String, boolean, File, Map, String...)static java.util.concurrent.ScheduledFuture<?>executeAfter(java.lang.Runnable runnable, long delay, java.util.concurrent.TimeUnit unit)static ExecHelper.ExecResultexecuteWithResult(java.lang.String executable, boolean checkExitCode, java.io.File workingDirectory, java.util.Map<java.lang.String,java.lang.String> envs, java.lang.String... arguments)static ExecHelper.ExecResultexecuteWithResult(java.lang.String executable, java.util.Map<java.lang.String,java.lang.String> envs, java.lang.String... arguments)static voidexecuteWithTerminal(com.intellij.openapi.project.Project project, java.lang.String title, boolean waitForProcessToExit, java.lang.String... command)static voidexecuteWithTerminal(com.intellij.openapi.project.Project project, java.lang.String title, boolean waitForProcessToExit, java.util.Map<java.lang.String,java.lang.String> envs, java.lang.String... command)static voidexecuteWithTerminal(com.intellij.openapi.project.Project project, java.lang.String title, java.io.File workingDirectory, boolean waitForProcessToExit, java.util.Map<java.lang.String,java.lang.String> envs, com.intellij.execution.ui.ConsoleView terminalToReuse, java.util.function.Function<ProcessHandlerInput,ExecProcessHandler> processHandlerFunction, com.intellij.execution.process.ProcessListener processListener, java.lang.String... command)static voidexecuteWithTerminal(com.intellij.openapi.project.Project project, java.lang.String title, java.io.File workingDirectory, boolean waitForProcessToExit, java.util.Map<java.lang.String,java.lang.String> envs, java.lang.String... command)static voidexecuteWithTerminal(com.intellij.openapi.project.Project project, java.lang.String title, java.io.File workingDirectory, java.lang.String... command)static voidexecuteWithTerminal(com.intellij.openapi.project.Project project, java.lang.String title, java.lang.String... command)static voidexecuteWithTerminal(com.intellij.openapi.project.Project project, java.lang.String title, java.util.Map<java.lang.String,java.lang.String> envs, com.intellij.execution.ui.ConsoleView terminalToReuse, com.intellij.execution.process.ProcessListener processListener, java.lang.String... command)static voidexecuteWithTerminal(com.intellij.openapi.project.Project project, java.lang.String title, java.util.Map<java.lang.String,java.lang.String> envs, com.intellij.execution.ui.ConsoleView terminalToReuse, java.lang.String... command)static voidexecuteWithTerminal(com.intellij.openapi.project.Project project, java.lang.String title, java.util.Map<java.lang.String,java.lang.String> envs, com.intellij.execution.ui.ConsoleView terminalToReuse, java.util.function.Function<ProcessHandlerInput,ExecProcessHandler> processHandlerFunction, com.intellij.execution.process.ProcessListener processListener, java.lang.String... command)static voidexecuteWithTerminal(com.intellij.openapi.project.Project project, java.lang.String title, java.util.Map<java.lang.String,java.lang.String> envs, java.lang.String... command)static voidexecuteWithUI(java.util.Map<java.lang.String,java.lang.String> envs, java.lang.Runnable initRunnable, java.util.function.Consumer<java.lang.String> runnable, java.lang.String... command)static voidexecuteWithUI(java.util.Map<java.lang.String,java.lang.String> envs, java.util.function.Consumer<java.lang.String> runnable, java.lang.String... command)static voidlinkProcessToTerminal(com.pty4j.PtyProcess p, com.intellij.openapi.project.Project project, java.lang.String title, boolean waitForProcessExit, java.lang.String... command)static voidlinkProcessToTerminal(com.pty4j.PtyProcess p, com.intellij.openapi.project.Project project, java.lang.String title, boolean waitForProcessExit, java.util.function.Function<ProcessHandlerInput,ExecProcessHandler> processHandlerFunction, com.intellij.execution.process.ProcessListener processListener, java.lang.String... command)static voidsubmit(java.lang.Runnable runnable)
-
-
-
Method Detail
-
executeAfter
public static java.util.concurrent.ScheduledFuture<?> executeAfter(java.lang.Runnable runnable, long delay, java.util.concurrent.TimeUnit unit)
-
submit
public static void submit(java.lang.Runnable runnable)
-
execute
public static java.lang.String execute(java.lang.String executable, boolean checkExitCode, java.io.File workingDirectory, java.util.Map<java.lang.String,java.lang.String> envs, com.intellij.execution.process.ProcessListener listener, java.lang.String... arguments) throws java.io.IOExceptionThis method combine out and err outputs in result string, if you need to have them separately use @linkexecuteWithResult(String, boolean, File, Map, String...)- Parameters:
executable- the executablecheckExitCode- if exit code should be checkedworkingDirectory- the working directory for the processenvs- the map for the environment variableslistener- the process listenerarguments- the arguments- Returns:
- the combined output and error stream as a String
- Throws:
java.io.IOException- if error during process execution
-
execute
public static java.lang.String execute(java.lang.String executable, boolean checkExitCode, java.io.File workingDirectory, java.util.Map<java.lang.String,java.lang.String> envs, java.lang.String... arguments) throws java.io.IOExceptionThis method combine out and err outputs in result string, if you need to have them separately use @linkexecuteWithResult(String, boolean, File, Map, String...)- Parameters:
executable- the executablecheckExitCode- if exit code should be checkedworkingDirectory- the working directory for the processenvs- the map for the environment variablesarguments- the arguments- Returns:
- the combined output and error stream as a String
- Throws:
java.io.IOException- if error during process execution
-
execute
public static java.lang.String execute(java.lang.String executable, java.io.File workingDirectory, java.util.Map<java.lang.String,java.lang.String> envs, java.lang.String... arguments) throws java.io.IOExceptionThis method combine out and err outputs in result string, if you need to have them separately use @linkexecuteWithResult(String, boolean, File, Map, String...)- Parameters:
executable- the executableworkingDirectory- the working directory for the processenvs- the map for the environment variablesarguments- the arguments- Returns:
- the combined output and error stream as a String
- Throws:
java.io.IOException- if error during process execution
-
execute
public static java.lang.String execute(java.lang.String executable, java.util.Map<java.lang.String,java.lang.String> envs, java.lang.String... arguments) throws java.io.IOExceptionThis method combine out and err outputs in result string, if you need to have them separately use @linkexecuteWithResult(String, boolean, File, Map, String...)- Parameters:
executable- the executableenvs- the map for the environment variablesarguments- the arguments- Returns:
- the combined output and error stream as a String
- Throws:
java.io.IOException- if error during process execution
-
execute
public static java.lang.String execute(java.lang.String executable, java.lang.String... arguments) throws java.io.IOExceptionThis method combine out and err outputs in result string, if you need to have them separately use @linkexecuteWithResult(String, boolean, File, Map, String...)- Parameters:
executable- the executablearguments- the arguments- Returns:
- the combined output and error stream as a String
- Throws:
java.io.IOException- if error during process execution
-
execute
public static java.lang.String execute(java.lang.String executable, java.io.File workingDirectory, java.lang.String... arguments) throws java.io.IOExceptionThis method combine out and err outputs in result string, if you need to have them separately use @linkexecuteWithResult(String, boolean, File, Map, String...)- Parameters:
executable- the executableworkingDirectory- the working directory for the processarguments- the arguments- Returns:
- the combined output and error stream as a String
- Throws:
java.io.IOException- if error during process execution
-
execute
public static java.lang.String execute(java.lang.String executable, boolean checkExitCode, java.util.Map<java.lang.String,java.lang.String> envs, java.lang.String... arguments) throws java.io.IOExceptionThis method combine out and err outputs in result string, if you need to have them separately use @linkexecuteWithResult(String, boolean, File, Map, String...)- Parameters:
executable- the executablecheckExitCode- if exit code should be checkedenvs- the map for the environment variablesarguments- the arguments- Returns:
- the combined output and error stream as a String
- Throws:
java.io.IOException- if error during process execution
-
execute
public static java.lang.String execute(java.lang.String executable, boolean checkExitCode, java.lang.String... arguments) throws java.io.IOExceptionThis method combine out and err outputs in result string, if you need to have them separately use @linkexecuteWithResult(String, boolean, File, Map, String...)- Parameters:
executable- the executablecheckExitCode- if exit code should be checkedarguments- the arguments- Returns:
- the combined output and error stream as a String
- Throws:
java.io.IOException- if error during process execution
-
executeWithResult
public static ExecHelper.ExecResult executeWithResult(java.lang.String executable, boolean checkExitCode, java.io.File workingDirectory, java.util.Map<java.lang.String,java.lang.String> envs, java.lang.String... arguments) throws java.io.IOException
- Throws:
java.io.IOException
-
executeWithResult
public static ExecHelper.ExecResult executeWithResult(java.lang.String executable, java.util.Map<java.lang.String,java.lang.String> envs, java.lang.String... arguments) throws java.io.IOException
- Throws:
java.io.IOException
-
createTerminalTabForReuse
public static CommonTerminalExecutionConsole createTerminalTabForReuse(com.intellij.openapi.project.Project project, java.lang.String title)
-
linkProcessToTerminal
public static void linkProcessToTerminal(com.pty4j.PtyProcess p, com.intellij.openapi.project.Project project, java.lang.String title, boolean waitForProcessExit, java.lang.String... command) throws java.io.IOException- Parameters:
p- ptyprocessproject- projecttitle- tab titlewaitForProcessExit- waitcommand- must not be empty (for correct thread attribution in the stacktrace)- Throws:
java.io.IOException- if errors while processing
-
linkProcessToTerminal
public static void linkProcessToTerminal(com.pty4j.PtyProcess p, com.intellij.openapi.project.Project project, java.lang.String title, boolean waitForProcessExit, java.util.function.Function<ProcessHandlerInput,ExecProcessHandler> processHandlerFunction, com.intellij.execution.process.ProcessListener processListener, java.lang.String... command) throws java.io.IOException- Parameters:
p- ptyprocessproject- projecttitle- tab titlewaitForProcessExit- waitprocessHandlerFunction- the process handler functionprocessListener- listener to attach to the processcommand- must not be empty (for correct thread attribution in the stacktrace)- Throws:
java.io.IOException- if errors while processing
-
attachProcessToTerminal
public static void attachProcessToTerminal(com.intellij.execution.ui.ConsoleView terminalExecutionConsole, com.pty4j.PtyProcess p, boolean waitForProcessExit, java.util.function.Function<ProcessHandlerInput,ExecProcessHandler> processHandlerFunction, com.intellij.execution.process.ProcessListener processListener, java.lang.String... command) throws java.io.IOException- Throws:
java.io.IOException
-
executeWithTerminal
public static void executeWithTerminal(com.intellij.openapi.project.Project project, java.lang.String title, java.io.File workingDirectory, boolean waitForProcessToExit, java.util.Map<java.lang.String,java.lang.String> envs, com.intellij.execution.ui.ConsoleView terminalToReuse, java.util.function.Function<ProcessHandlerInput,ExecProcessHandler> processHandlerFunction, com.intellij.execution.process.ProcessListener processListener, java.lang.String... command) throws java.io.IOException- Throws:
java.io.IOException
-
executeWithTerminal
public static void executeWithTerminal(com.intellij.openapi.project.Project project, java.lang.String title, java.io.File workingDirectory, java.lang.String... command) throws java.io.IOException- Throws:
java.io.IOException
-
executeWithTerminal
public static void executeWithTerminal(com.intellij.openapi.project.Project project, java.lang.String title, boolean waitForProcessToExit, java.util.Map<java.lang.String,java.lang.String> envs, java.lang.String... command) throws java.io.IOException- Throws:
java.io.IOException
-
executeWithTerminal
public static void executeWithTerminal(com.intellij.openapi.project.Project project, java.lang.String title, boolean waitForProcessToExit, java.lang.String... command) throws java.io.IOException- Throws:
java.io.IOException
-
executeWithTerminal
public static void executeWithTerminal(com.intellij.openapi.project.Project project, java.lang.String title, java.util.Map<java.lang.String,java.lang.String> envs, java.lang.String... command) throws java.io.IOException- Throws:
java.io.IOException
-
executeWithTerminal
public static void executeWithTerminal(com.intellij.openapi.project.Project project, java.lang.String title, java.lang.String... command) throws java.io.IOException- Throws:
java.io.IOException
-
executeWithTerminal
public static void executeWithTerminal(com.intellij.openapi.project.Project project, java.lang.String title, java.io.File workingDirectory, boolean waitForProcessToExit, java.util.Map<java.lang.String,java.lang.String> envs, java.lang.String... command) throws java.io.IOException- Throws:
java.io.IOException
-
executeWithTerminal
public static void executeWithTerminal(com.intellij.openapi.project.Project project, java.lang.String title, java.util.Map<java.lang.String,java.lang.String> envs, com.intellij.execution.ui.ConsoleView terminalToReuse, java.lang.String... command) throws java.io.IOException- Throws:
java.io.IOException
-
executeWithTerminal
public static void executeWithTerminal(com.intellij.openapi.project.Project project, java.lang.String title, java.util.Map<java.lang.String,java.lang.String> envs, com.intellij.execution.ui.ConsoleView terminalToReuse, com.intellij.execution.process.ProcessListener processListener, java.lang.String... command) throws java.io.IOException- Throws:
java.io.IOException
-
executeWithTerminal
public static void executeWithTerminal(com.intellij.openapi.project.Project project, java.lang.String title, java.util.Map<java.lang.String,java.lang.String> envs, com.intellij.execution.ui.ConsoleView terminalToReuse, java.util.function.Function<ProcessHandlerInput,ExecProcessHandler> processHandlerFunction, com.intellij.execution.process.ProcessListener processListener, java.lang.String... command) throws java.io.IOException- Throws:
java.io.IOException
-
executeWithUI
public static void executeWithUI(java.util.Map<java.lang.String,java.lang.String> envs, java.lang.Runnable initRunnable, java.util.function.Consumer<java.lang.String> runnable, java.lang.String... command) throws java.io.IOException- Throws:
java.io.IOException
-
executeWithUI
public static void executeWithUI(java.util.Map<java.lang.String,java.lang.String> envs, java.util.function.Consumer<java.lang.String> runnable, java.lang.String... command) throws java.io.IOException- Throws:
java.io.IOException
-
-