public class OSProcessHandler extends BaseOSProcessHandler
| Modifier and Type | Class and Description |
|---|---|
static class |
OSProcessHandler.Silent |
BaseOSProcessHandler.SimpleOutputReadermyCharset, myCommandLine, myPresentableName, myProcess, myWaitForSILENTLY_DESTROY_ON_CLOSE, TERMINATION_REQUESTED| Constructor and Description |
|---|
OSProcessHandler(GeneralCommandLine commandLine) |
OSProcessHandler(java.lang.Process process)
Deprecated.
use
OSProcessHandler(Process, String) (or any other constructor) |
OSProcessHandler(java.lang.Process process,
java.lang.String commandLine)
commandLine must not be empty (for correct thread attribution in the stacktrace) |
OSProcessHandler(java.lang.Process process,
java.lang.String commandLine,
java.nio.charset.Charset charset)
commandLine must not be empty (for correct thread attribution in the stacktrace) |
OSProcessHandler(java.lang.Process process,
java.lang.String commandLine,
java.nio.charset.Charset charset,
java.util.Set<? extends java.io.File> filesToDelete)
commandLine must not be empty (for correct thread attribution in the stacktrace) |
| Modifier and Type | Method and Description |
|---|---|
static void |
checkEdtAndReadAction(ProcessHandler processHandler)
Checks if we are going to wait for
processHandler to finish on EDT or under ReadAction. |
static void |
deleteFileOnTermination(GeneralCommandLine commandLine,
java.io.File fileToDelete)
Registers a file to delete after the given command line finishes.
|
protected void |
doDestroyProcess() |
static ModalityState |
getDefaultModality() |
protected void |
killProcessTree(java.lang.Process process)
Kills the whole process tree asynchronously.
|
protected void |
onOSProcessTerminated(int exitCode) |
static boolean |
processCanBeKilledByOS(java.lang.Process process) |
protected boolean |
processHasSeparateErrorStream() |
protected BaseOutputReader.Options |
readerOptions()
Rule of thumb: use
BaseOutputReader.Options#BLOCKING for short-living process that you never want to "disconnect" from. |
void |
setHasPty(boolean hasPty)
In case of PTY this process handler will use blocking read because
InputStream.available() doesn't work for Pty4j, and there
is no reason to "disconnect" leaving PTY alive. |
void |
setShouldDestroyProcessRecursively(boolean destroyRecursively) |
protected boolean |
shouldDestroyProcessRecursively() |
boolean |
waitFor()
Wait for process execution.
|
boolean |
waitFor(long timeoutInMilliseconds) |
createErrorDataReader, createOutputDataReader, createProcessErrReader, createProcessOutReader, executeOnPooledThread, executeTask, startNotify, toStringcloseStreams, destroyProcessImpl, detachIsDefault, detachProcessImpl, getCharset, getCommandLine, getProcess, getProcessInputaddProcessListener, addProcessListener, destroyProcess, detachProcess, getExitCode, isProcessTerminated, isProcessTerminating, isSilentlyDestroyOnClose, isStartNotified, notifyProcessDetached, notifyProcessTerminated, notifyTextAvailable, removeProcessListenerchangeUserMap, clearUserData, clone, copyCopyableDataTo, copyUserDataTo, getCopyableUserData, getUserData, getUserDataString, getUserMap, isUserDataEmpty, putCopyableUserData, putUserData, putUserDataIfAbsent, replace, setUserMappublic OSProcessHandler(GeneralCommandLine commandLine) throws ExecutionException
ExecutionException@Deprecated public OSProcessHandler(java.lang.Process process)
OSProcessHandler(Process, String) (or any other constructor)public OSProcessHandler(java.lang.Process process,
java.lang.String commandLine)
commandLine must not be empty (for correct thread attribution in the stacktrace)public OSProcessHandler(java.lang.Process process,
java.lang.String commandLine,
java.nio.charset.Charset charset)
commandLine must not be empty (for correct thread attribution in the stacktrace)public OSProcessHandler(java.lang.Process process,
java.lang.String commandLine,
java.nio.charset.Charset charset,
java.util.Set<? extends java.io.File> filesToDelete)
commandLine must not be empty (for correct thread attribution in the stacktrace)public static ModalityState getDefaultModality()
public boolean waitFor()
ProcessHandlerwaitFor in class BaseOSProcessHandlerpublic boolean waitFor(long timeoutInMilliseconds)
waitFor in class BaseOSProcessHandlerpublic static void checkEdtAndReadAction(ProcessHandler processHandler)
processHandler to finish on EDT or under ReadAction. Logs error if we do so.
ReadAction:
other thread and invoke a callback.Task.BackgroundableWriteAction:
modal progress.Task.BackgroundableWriteAction
other thread and invoke a callback.Task.Backgroundableprotected void onOSProcessTerminated(int exitCode)
onOSProcessTerminated in class BaseProcessHandler<java.lang.Process>protected boolean processHasSeparateErrorStream()
processHasSeparateErrorStream in class BaseOSProcessHandlerprotected boolean shouldDestroyProcessRecursively()
public void setShouldDestroyProcessRecursively(boolean destroyRecursively)
protected void doDestroyProcess()
doDestroyProcess in class BaseProcessHandler<java.lang.Process>public static boolean processCanBeKilledByOS(java.lang.Process process)
protected void killProcessTree(java.lang.Process process)
process - Processpublic void setHasPty(boolean hasPty)
In case of PTY this process handler will use blocking read because InputStream.available() doesn't work for Pty4j, and there
is no reason to "disconnect" leaving PTY alive. See BaseDataReader.SleepingPolicy for more info.
The value should be set before BaseOSProcessHandler.startNotify() invocation.
It is set by default in case of using GeneralCommandLine based constructor.
hasPty - true if process is PTY-based.protected BaseOutputReader.Options readerOptions()
BaseOutputReader.Options#BLOCKING for short-living process that you never want to "disconnect" from.
See BaseDataReader.SleepingPolicy for the whole story.readerOptions in class BaseOSProcessHandlerpublic static void deleteFileOnTermination(GeneralCommandLine commandLine, java.io.File fileToDelete)
OSProcessHandler(GeneralCommandLine).