public class ColoredProcessHandler extends KillableProcessHandler implements AnsiEscapeDecoder.ColoredTextAcceptor
This process handler supports ANSI coloring.
Although it supports the feature
, it is turned off by default for compatibility reasons.
To turn it on either call KillableProcessHandler.setShouldKillProcessSoftly(boolean)
, or extend from KillableColoredProcessHandler
.
OSProcessHandler.Silent
BaseOSProcessHandler.SimpleOutputReader
myCharset, myCommandLine, myPresentableName, myProcess, myWaitFor
SILENTLY_DESTROY_ON_CLOSE, TERMINATION_REQUESTED
Constructor and Description |
---|
ColoredProcessHandler(GeneralCommandLine commandLine) |
ColoredProcessHandler(java.lang.Process process,
java.lang.String commandLine)
commandLine must not be not empty (for correct thread attribution in the stacktrace) |
ColoredProcessHandler(java.lang.Process process,
java.lang.String commandLine,
java.nio.charset.Charset charset)
commandLine must not be not empty (for correct thread attribution in the stacktrace) |
ColoredProcessHandler(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 not empty (for correct thread attribution in the stacktrace) |
Modifier and Type | Method and Description |
---|---|
void |
addColoredTextListener(AnsiEscapeDecoder.ColoredTextAcceptor listener)
Deprecated.
use
ProcessHandler.addProcessListener(ProcessListener) instead and
listen for ProcessListener.onTextAvailable(ProcessEvent, Key) events |
void |
coloredTextAvailable(java.lang.String text,
Key attributes)
Override this method to handle colored text lines.
|
protected void |
notifyColoredListeners(java.lang.String text,
Key attributes)
Deprecated.
the method is kept for backward compatibility only
|
void |
notifyTextAvailable(java.lang.String text,
Key outputType) |
canKillProcess, destroyProcessGracefully, destroyProcessImpl, doDestroyProcess, killProcess, mediate, notifyProcessTerminated, setShouldKillProcessSoftly, setShouldKillProcessSoftlyWithWinP, shouldKillProcessSoftly
checkEdtAndReadAction, deleteFileOnTermination, getDefaultModality, killProcessTree, onOSProcessTerminated, processCanBeKilledByOS, processHasSeparateErrorStream, readerOptions, setHasPty, setShouldDestroyProcessRecursively, shouldDestroyProcessRecursively, waitFor, waitFor
createErrorDataReader, createOutputDataReader, createProcessErrReader, createProcessOutReader, executeOnPooledThread, executeTask, startNotify, toString
closeStreams, detachIsDefault, detachProcessImpl, getCharset, getCommandLine, getProcess, getProcessInput
addProcessListener, addProcessListener, destroyProcess, detachProcess, getExitCode, isProcessTerminated, isProcessTerminating, isSilentlyDestroyOnClose, isStartNotified, notifyProcessDetached, removeProcessListener
changeUserMap, clearUserData, clone, copyCopyableDataTo, copyUserDataTo, getCopyableUserData, getUserData, getUserDataString, getUserMap, isUserDataEmpty, putCopyableUserData, putUserData, putUserDataIfAbsent, replace, setUserMap
public ColoredProcessHandler(GeneralCommandLine commandLine) throws ExecutionException
ExecutionException
public ColoredProcessHandler(java.lang.Process process, java.lang.String commandLine)
commandLine
must not be not empty (for correct thread attribution in the stacktrace)public ColoredProcessHandler(java.lang.Process process, java.lang.String commandLine, java.nio.charset.Charset charset)
commandLine
must not be not empty (for correct thread attribution in the stacktrace)public ColoredProcessHandler(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 not empty (for correct thread attribution in the stacktrace)public final void notifyTextAvailable(java.lang.String text, Key outputType)
notifyTextAvailable
in class ProcessHandler
public void coloredTextAvailable(java.lang.String text, Key attributes)
coloredTextAvailable
in interface AnsiEscapeDecoder.ColoredTextAcceptor
@Deprecated protected void notifyColoredListeners(java.lang.String text, Key attributes)
@Deprecated public void addColoredTextListener(AnsiEscapeDecoder.ColoredTextAcceptor listener)
ProcessHandler.addProcessListener(ProcessListener)
instead and
listen for ProcessListener.onTextAvailable(ProcessEvent, Key)
events