Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
248,700
GeneralCommandLine (boolean redirectErrorStream) { myRedirectErrorStream = redirectErrorStream; return this; }
withRedirectErrorStream
248,701
void (boolean redirectErrorStream) { withRedirectErrorStream(redirectErrorStream); }
setRedirectErrorStream
248,702
File () { return myInputFile; }
getInputFile
248,703
GeneralCommandLine (@Nullable File file) { myInputFile = file; return this; }
withInput
248,704
String (@Nullable String exeName) { return ParametersListUtil.join(getCommandLineList(exeName)); }
getCommandLineString
248,705
List<String> (@Nullable String exeName) { List<@NlsSafe String> commands = new ArrayList<>(); String exe = StringUtil.notNullize(exeName, StringUtil.notNullize(myExePath, "<null>")); commands.add(exe); commands.addAll(myProgramParams.getList()); return commands; }
getCommandLineList
248,706
String () { return getPreparedCommandLine(Platform.current()); }
getPreparedCommandLine
248,707
String (@NotNull Platform platform) { String exePath = myExePath != null ? myExePath : ""; return StringUtil.join(prepareCommandLine(exePath, myProgramParams.getList(), platform), "\n"); }
getPreparedCommandLine
248,708
List<String> (@NotNull String command, @NotNull List<String> parameters, @NotNull Platform platform) { return CommandLineUtil.toCommandLine(command, parameters, platform); }
prepareCommandLine
248,709
void (Function<ProcessBuilder, Process> processCreator) { myProcessCreator = processCreator; }
setProcessCreator
248,710
ProcessBuilder (List<String> escapedCommands) { ProcessBuilder builder = new ProcessBuilder(escapedCommands); setupEnvironment(builder.environment()); builder.directory(myWorkDirectory); builder.redirectErrorStream(myRedirectErrorStream); if (myInputFile != null) { builder.redirectInput(ProcessBuilder.Redirect.from(myI...
toProcessBuilderInternal
248,711
ProcessBuilder (@NotNull ProcessBuilder builder) { return builder; }
buildProcess
248,712
void (@NotNull Map<String, String> environment) { environment.clear(); if (myParentEnvironmentType != ParentEnvironmentType.NONE) { environment.putAll(getParentEnvironment()); } if (SystemInfo.isUnix) { File workDirectory = getWorkDirectory(); if (workDirectory != null) { environment.put("PWD", FileUtil.toSystemDepende...
setupEnvironment
248,713
String (@NotNull String parameter) { return CommandLineUtil.specialQuote(parameter); }
inescapableQuote
248,714
String () { return myExePath + " " + myProgramParams; }
toString
248,715
void (Map<? extends String, ? extends String> map) { if (map != null) { super.putAll(map); } }
putAll
248,716
void (@NotNull final String text, @NotNull final Key outputType) { myAnsiEscapeDecoder.escapeText(text, outputType, this); }
notifyTextAvailable
248,717
void (@NotNull String text, @NotNull Key attributes) { super.notifyTextAvailable(text, attributes); }
coloredTextAvailable
248,718
void (@NotNull ProcessEvent event, @NotNull Key outputType) { if (outputTypeFilter.value(outputType)) { final String text = event.getText(); outputBuilder.append(text); LOG.debug(text); } }
onTextAvailable
248,719
void (@NotNull ProcessEvent event, @NotNull Key outputType) { LOG.debug(outputType + ": " + event.getText()); }
onTextAvailable
248,720
boolean (@NotNull String exeName) { assert exeName.indexOf(File.pathSeparatorChar) == -1 : exeName; File exeFile = PathEnvironmentVariableUtil.findInPath(exeName); if (exeFile != null) { return true; } String pathWithExt = PathEnvironmentVariableUtil.findExecutableInWindowsPath(exeName); return !pathWithExt.equals(exeN...
isExecutableInPath
248,721
String () { return myFilteredOutput.toString(); }
getFilteredOutput
248,722
String () { return myMergedOutput.toString(); }
getMergedOutput
248,723
String[] () { return getFilteredOutput().split("\n"); }
getOutputToParseArray
248,724
String () { String outputToParse = getFilteredOutput(); return StringUtil.isEmpty(outputToParse) ? getMergedOutput() : outputToParse; }
getDescriptiveOutput
248,725
void (@NotNull ProcessEvent event, @NotNull Key outputType) { final String text = event.getText(); if (myScriptOutputType.value(outputType)) { myFilteredOutput.append(text); } myMergedOutput.append(text); }
onTextAvailable
248,726
void (@NotNull ProcessHandler processHandler, long millisTimeout, @Nullable String commandLine) { if (processHandler.isProcessTerminated()) { if (commandLine == null && processHandler instanceof BaseProcessHandler) { commandLine = ((BaseProcessHandler<?>)processHandler).getCommandLine(); } LOG.warn("Process '" + comman...
terminateProcessHandler
248,727
OutputStream () { return myOriginalProcess.getOutputStream(); }
getOutputStream
248,728
InputStream () { return myOriginalProcess.getInputStream(); }
getInputStream
248,729
InputStream () { return myOriginalProcess.getErrorStream(); }
getErrorStream
248,730
int () { return myOriginalProcess.exitValue(); }
exitValue
248,731
void () { myOriginalProcess.destroy(); }
destroy
248,732
Process () { return myOriginalProcess; }
getOriginalProcess
248,733
int () { return myPid; }
getPid
248,734
int () { return myParentPid; }
getParentPid
248,735
String () { return myCommandLine; }
getCommandLine
248,736
String () { return myExecutableName; }
getExecutableName
248,737
Optional<String> () { return myExecutablePath.map(s -> { try { return new File(s).getCanonicalPath(); } catch (IOException e) { return s; } }); }
getExecutableCannonicalPath
248,738
String () { return StringUtil.trimEnd(myExecutableName, ".exe", true); }
getExecutableDisplayName
248,739
String () { return myArgs; }
getArgs
248,740
String () { return myUser; }
getUser
248,741
ThreeState () { return myOwnedByCurrentUser; }
isOwnedByCurrentUser
248,742
String () { return myPid + (myUser != null ? " " + myUser : "") + " '" + myCommandLine + "' '" + myExecutableName + "' '" + myArgs + "'" + myExecutablePath.map(s -> " " + s).orElse(""); }
toString
248,743
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ProcessInfo info = (ProcessInfo)o; if (myPid != info.myPid) return false; if (!myExecutableName.equals(info.myExecutableName)) return false; if (!myArgs.equals(info.myArgs)) return false; if (!myCommandLine.equal...
equals
248,744
int () { int result = myPid; result = 31 * result + myExecutableName.hashCode(); result = 31 * result + myArgs.hashCode(); result = 31 * result + myCommandLine.hashCode(); result = 31 * result + myParentPid; result = 31 * result + (myUser != null ? myUser.hashCode() : 0); result = 31 * result + myOwnedByCurrentUser.has...
hashCode
248,745
ProcessService () { return ApplicationManager.getApplication().getService(ProcessService.class); }
getInstance
248,746
boolean (@NotNull Process process, char event) { OutputStream os = process.getOutputStream(); if (os != null) { try { os.write(IAC); os.write(event); os.flush(); return true; } catch (IOException e) { LOG.info("Cannot send " + IAC + "+" + event + " to runnerw", e); } } return false; }
sendCtrlEventThroughStream
248,747
void (@NotNull GeneralCommandLine commandLine, boolean showConsole) { if (!SystemInfo.isWindows || isRunnerCommandInjected(commandLine)) { return; } final String path = getRunnerPath(); if (path != null) { commandLine.getParametersList().addAt(0, commandLine.getExePath()); if (showConsole) { commandLine.getParametersLi...
injectRunnerCommand
248,748
boolean (@NotNull GeneralCommandLine commandLine) { return MEDIATOR_KEY.get(commandLine) == Boolean.TRUE; }
isRunnerCommandInjected
248,749
void (@NotNull GeneralCommandLine commandLine) { injectRunnerCommand(commandLine, true); }
withExternalConsole
248,750
void (@Nullable String text) { myStdoutBuilder.append(text); }
appendStdout
248,751
void (@Nullable String text) { myStderrBuilder.append(text); }
appendStderr
248,752
List<String> (String s, boolean excludeEmptyLines) { String converted = StringUtil.convertLineSeparators(s); return StringUtil.split(converted, "\n", true, excludeEmptyLines); }
splitLines
248,753
boolean (@NotNull Logger logger) { int ec = getExitCode(); if (ec == 0 && !isTimeout()) { return true; } logger.info(isTimeout() ? "Timed out" : "Exit code " + ec); String output = getStderr(); if (output.isEmpty()) output = getStdout(); if (!output.isEmpty()) { logger.info(output); } return false; }
checkSuccess
248,754
void (int exitCode) { myExitCode = exitCode; }
setExitCode
248,755
int () { Integer code = myExitCode; return code == null ? -1 : code; }
getExitCode
248,756
boolean () { return myExitCode != null; }
isExitCodeSet
248,757
void () { myTimeout = true; }
setTimeout
248,758
boolean () { return myTimeout; }
isTimeout
248,759
void () { myCancelled = true; }
setCancelled
248,760
boolean () { return myCancelled; }
isCancelled
248,761
String () { return "{" + "exitCode=" + myExitCode + ", timeout=" + myTimeout + ", cancelled=" + myCancelled + ", stdout=" + myStdoutBuilder + ", stderr=" + myStderrBuilder + '}'; }
toString
248,762
void (@NotNull ProcessEvent event, @NotNull Key outputType) { addToOutput(event.getText(), outputType); }
onTextAvailable
248,763
void (String text, Key outputType) { if (outputType == ProcessOutputTypes.STDOUT) { myOutput.appendStdout(text); } else if (outputType == ProcessOutputTypes.STDERR) { myOutput.appendStderr(text); } }
addToOutput
248,764
void (@NotNull ProcessEvent event) { myOutput.setExitCode(event.getExitCode()); }
processTerminated
248,765
ProcessOutput () { return myOutput; }
getOutput
248,766
void (@NotNull String text, @NotNull Key outputType, @NotNull ColoredTextAcceptor textAcceptor) { AnsiStreamingLexer effectiveLexer; AnsiTerminalEmulator effectiveEmulator; if (ProcessOutputType.isStdout(outputType)) { effectiveLexer = myStdoutLexer; effectiveEmulator = myStdoutEmulator; } else if (ProcessOutputType.is...
escapeText
248,767
void (@NotNull String text, @NotNull Key outputType, @NotNull ColoredTextAcceptor textAcceptor) { List<Pair<String, Key>> chunks = processTextChunk(null, text, outputType, textAcceptor); if (chunks != null && textAcceptor instanceof ColoredChunksAcceptor) { ((ColoredChunksAcceptor)textAcceptor).coloredChunksAvailable(c...
processTextWithoutAnsi
248,768
Key (@NotNull Key outputType) { if (ProcessOutputType.isStdout(outputType)) { return myStdoutEmulator.isInitialState() ? outputType : myColoredOutputTypeRegistry.getOutputType(myStdoutEmulator, outputType); } if (ProcessOutputType.isStderr(outputType)) { return myStderrEmulator.isInitialState() ? outputType : myColored...
getCurrentOutputAttributes
248,769
ColoredOutputTypeRegistry () { return ApplicationManager.getApplication().getService(ColoredOutputTypeRegistry.class); }
getInstance
248,770
ProcessOutput () { myProcessHandler.startNotify(); if (myProcessHandler.waitFor()) { setErrorCodeIfNotYetSet(); } else { LOG.info("runProcess: exit value unavailable"); } return myOutput; }
runProcess
248,771
ProcessOutput (int timeoutInMilliseconds) { return runProcess(timeoutInMilliseconds, true); }
runProcess
248,772
ProcessOutput (int timeoutInMilliseconds, boolean destroyOnTimeout) { // keep in sync with runProcessWithProgressIndicator if (timeoutInMilliseconds <= 0) { return runProcess(); } else { myProcessHandler.startNotify(); if (myProcessHandler.waitFor(timeoutInMilliseconds)) { setErrorCodeIfNotYetSet(); } else { if (destro...
runProcess
248,773
ProcessOutput (@NotNull ProgressIndicator indicator) { return runProcess(indicator, -1); }
runProcess
248,774
ProcessOutput (@NotNull ProgressIndicator indicator, int timeoutInMilliseconds) { return runProcess(indicator, timeoutInMilliseconds, true); }
runProcess
248,775
ProcessOutput (@NotNull ProgressIndicator indicator, int timeoutInMilliseconds, boolean destroyOnTimeout) { // keep in sync with runProcess if (timeoutInMilliseconds <= 0) { timeoutInMilliseconds = Integer.MAX_VALUE; } final int WAIT_INTERVAL = 10; int waitingTime = 0; boolean setExitCode = true; myProcessHandler.start...
runProcess
248,776
void () { // if exit code was set on processTerminated, no need to rewrite it // WinPtyProcess returns -2 if pty is already closed if (!myOutput.isExitCodeSet() && myProcessHandler instanceof BaseProcessHandler) { myOutput.setExitCode(((BaseProcessHandler<?>)myProcessHandler).getProcess().exitValue()); } }
setErrorCodeIfNotYetSet
248,777
ModalityState () { Application app = ApplicationManager.getApplication(); return app == null ? ModalityState.nonModal() : app.getDefaultModalityState(); }
getDefaultModality
248,778
boolean () { checkEdtAndReadAction(this); return super.waitFor(); }
waitFor
248,779
boolean (long timeoutInMilliseconds) { if (timeoutInMilliseconds > ALLOWED_TIMEOUT_THRESHOLD) { checkEdtAndReadAction(this); } return super.waitFor(timeoutInMilliseconds); }
waitFor
248,780
void (@NotNull ProcessHandler processHandler) { Application application = ApplicationManager.getApplication(); if (application == null || !application.isInternal() || application.isHeadlessEnvironment()) { return; } String message = null; if (application.isDispatchThread()) { message = "Synchronous execution on EDT: ";...
checkEdtAndReadAction
248,781
void (Set<? extends File> tempFiles) { if (tempFiles != null) { try { for (File file : tempFiles) { FileUtil.delete(file); } } catch (Throwable t) { LOG.error("failed to delete temp. files", t); } } }
deleteTempFiles
248,782
void (int exitCode) { if (myModality != ModalityState.nonModal()) { ProgressManager.getInstance().runProcess(() -> super.onOSProcessTerminated(exitCode), new EmptyProgressIndicator(myModality)); } else { super.onOSProcessTerminated(exitCode); } deleteTempFiles(myFilesToDelete); }
onOSProcessTerminated
248,783
boolean () { return myHasErrorStream; }
processHasSeparateErrorStream
248,784
boolean () { // Override this method if you want to kill process recursively (a whole process tree) by default // (such behaviour is better than default Java one, which doesn't kill children processes). return myDestroyRecursively; }
shouldDestroyProcessRecursively
248,785
void (boolean destroyRecursively) { myDestroyRecursively = destroyRecursively; }
setShouldDestroyProcessRecursively
248,786
void () { // Override this method if you want to customize default destroy behaviour, e.g. if you want to use some soft-kill. final Process process = getProcess(); if (shouldDestroyProcessRecursively() && processCanBeKilledByOS(process)) { killProcessTree(process); } else { process.destroy(); } }
doDestroyProcess
248,787
boolean (Process process) { return !(process instanceof SelfKiller); }
processCanBeKilledByOS
248,788
void (final @NotNull Process process) { if (ApplicationManager.getApplication().isUnitTestMode()) { killProcessTreeSync(process); } else { executeTask(() -> killProcessTreeSync(process)); } }
killProcessTree
248,789
void (@NotNull Process process) { LOG.debug("killing process tree"); final boolean destroyed = OSProcessUtil.killProcessTree(process); if (!destroyed) { if (!process.isAlive()) { LOG.warn("Process has been already terminated: " + myCommandLine); } else { LOG.warn("Cannot kill process tree. Trying to destroy process usi...
killProcessTreeSync
248,790
boolean () { if (myHasPty == null) { myHasPty = LoadingState.COMPONENTS_LOADED.isOccurred() && ProcessService.getInstance().isLocalPtyProcess(getProcess()); } return myHasPty; }
hasPty
248,791
void (boolean hasPty) { myHasPty = hasPty; }
setHasPty
248,792
void (@NotNull GeneralCommandLine commandLine, @NotNull File fileToDelete) { Set<File> set = commandLine.getUserData(DELETE_FILES_ON_TERMINATION); if (set == null) { set = new HashSet<>(); commandLine.putUserData(DELETE_FILES_ON_TERMINATION, set); } set.add(fileToDelete); }
deleteFileOnTermination
248,793
void () { while (myEndOffset < myBuffer.length() && isInRange(myBuffer.charAt(myEndOffset), (char)0x30, (char)0x3F)) { myEndOffset++; } while (myEndOffset < myBuffer.length() && isInRange(myBuffer.charAt(myEndOffset), (char)0x20, (char)0x2F)) { myEndOffset++; } if (myEndOffset == myBuffer.length()) { incompleteSequence...
processCSISequence
248,794
boolean () { // There can by anything from 0x40–0x5F https://en.wikipedia.org/wiki/ANSI_escape_code#Escape_sequences // but we are ignoring most of it for now switch (myBuffer.charAt(myEndOffset)) { case '[' -> { myEndOffset++; processCSISequence(); return true; } case '=' -> { //DECKPAM myElementType = CONTROL; myEndO...
decodeEscapeSequence
248,795
void () { int escapeIndex = myBuffer.indexOf(ESCAPE, myEndOffset); myEndOffset = escapeIndex != -1 ? escapeIndex : myBuffer.length(); myElementType = TEXT; }
advanceToEscape
248,796
void () { myElementType = null; myEndOffset = myStartOffset; }
incompleteSequence
248,797
boolean (char character, char startRange, char endRange) { return startRange <= character && character <= endRange; }
isInRange
248,798
String () { return "ANSI: " + myName; }
toString
248,799
CapturingProcessAdapter (ProcessOutput processOutput) { return new CapturingProcessAdapter(processOutput); }
createProcessAdapter