Java Code Examples for com.intellij.execution.process.ProcessOutputTypes#STDERR
The following examples show how to use
com.intellij.execution.process.ProcessOutputTypes#STDERR .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OutputLineSplitterTest.java From consulo with Apache License 2.0 | 6 votes |
@Override protected void setUp() throws Exception { super.setUp(); mySplitter = new OutputLineSplitter(false) { @Override protected void onLineAvailable(@Nonnull String text, @Nonnull Key outputType, boolean tcLikeFakeOutput) { if (ProcessOutputTypes.STDERR != outputType && ProcessOutputTypes.SYSTEM != outputType) outputType = ProcessOutputTypes.STDOUT; synchronized (myOutput) { List<String> list = myOutput.get(outputType); if (list == null) { myOutput.put(outputType, list = new ArrayList<String>()); } list.add(text); } } }; }
Example 2
Source File: BlazeConsoleServiceImpl.java From intellij with Apache License 2.0 | 5 votes |
@Override public void print(String text, ConsoleViewContentType contentType) { Key<?> key = contentType == ConsoleViewContentType.ERROR_OUTPUT ? ProcessOutputTypes.STDERR : ProcessOutputTypes.STDOUT; ansiEscapeDecoder.escapeText(text, key, this); }
Example 3
Source File: BuckCommandHandler.java From Buck-IntelliJ-Plugin with Apache License 2.0 | 5 votes |
protected void onTextAvailable(final String text, final Key outputType) { Iterator<String> lines = LineHandlerHelper.splitText(text).iterator(); // We only care about STDERR for buck outputs if (ProcessOutputTypes.STDERR == outputType) { notifyLines(outputType, lines, mStderrLine); } }
Example 4
Source File: PantsIntegrationTestCase.java From intellij-pants-plugin with Apache License 2.0 | 5 votes |
@NotNull protected RunResult runWithConfiguration(RunConfiguration configuration) { PantsMakeBeforeRun.replaceDefaultMakeWithPantsMake(configuration); PantsMakeBeforeRun.setRunConfigurationWorkingDirectory(configuration); PantsJUnitRunnerAndConfigurationSettings runnerAndConfigurationSettings = new PantsJUnitRunnerAndConfigurationSettings(configuration); ExecutionEnvironmentBuilder environmentBuilder = ExecutionUtil.createEnvironment(DefaultRunExecutor.getRunExecutorInstance(), runnerAndConfigurationSettings); ExecutionEnvironment environment = environmentBuilder.build(); List<String> output = new ArrayList<>(); List<String> errors = new ArrayList<>(); ProcessAdapter processAdapter = new ProcessAdapter() { @Override public void onTextAvailable(@NotNull ProcessEvent event, @NotNull Key outputType) { if (outputType == ProcessOutputTypes.STDOUT) { output.add(event.getText()); } else if (outputType == ProcessOutputTypes.STDERR) { errors.add(event.getText()); } } }; ProgramRunnerUtil.executeConfiguration(environment, false, false); OSProcessHandler handler = (OSProcessHandler) environment.getContentToReuse().getProcessHandler(); handler.addProcessListener(processAdapter); assertTrue(handler.waitFor()); return new RunResult(handler.getExitCode(), output, errors); }
Example 5
Source File: ExecutionOutputParser.java From idea-gitignore with MIT License | 5 votes |
/** * Handles single output line. * * @param text execution response * @param outputType output type */ public void onTextAvailable(@NotNull String text, @NotNull Key outputType) { if (outputType == ProcessOutputTypes.SYSTEM) { return; } if (outputType == ProcessOutputTypes.STDERR) { errorsReported = true; return; } ContainerUtil.addIfNotNull(outputs, parseOutput(StringUtil.trimEnd(text, "\n").trim())); }
Example 6
Source File: BuckCommandHandler.java From buck with Apache License 2.0 | 5 votes |
/** * Notify listeners for each complete line. Note that in the case of stderr, the last line is * saved. */ protected void notifyLines(final Key outputType, final Iterable<String> lines) { if (outputType == ProcessOutputTypes.STDERR) { StringBuilder stderr = new StringBuilder(); for (String line : lines) { // Check if the line has at least one character or digit if (CHARACTER_DIGITS_PATTERN.matcher(line).matches()) { stderr.append(line); } } if (stderr.length() != 0) { buckModule.getBuckEventsConsumer().consumeConsoleEvent(stderr.toString()); } } }
Example 7
Source File: ThriftOutputConsumer.java From intellij-thrift with Apache License 2.0 | 5 votes |
@Override public void onTextAvailable(ProcessEvent event, Key outputType) { if (outputType == ProcessOutputTypes.STDERR) { stdOutput.append(event.getText()); } else if (outputType == ProcessOutputTypes.STDOUT) { stdOutput.append(event.getText()); } }
Example 8
Source File: OutputListener.java From consulo with Apache License 2.0 | 5 votes |
@Override public void onTextAvailable(ProcessEvent event, Key outputType) { if (outputType == ProcessOutputTypes.STDERR) { err.append(event.getText()); } else if (outputType == ProcessOutputTypes.SYSTEM) { // skip } else { out.append(event.getText()); } }
Example 9
Source File: DefaultLogFilterModel.java From consulo with Apache License 2.0 | 5 votes |
@Override @Nonnull public MyProcessingResult processLine(String line) { final String type = LogConsolePreferences.getType(line); Key contentType = type != null ? LogConsolePreferences.getProcessOutputTypes(type) : (LogConsolePreferences.ERROR.equals(myPrevType) ? ProcessOutputTypes.STDERR : ProcessOutputTypes.STDOUT); if (type != null) { myPrevType = type; } final boolean applicable = isApplicable(line); return new MyProcessingResult(contentType, applicable, null); }
Example 10
Source File: PrintOutput.java From intellij with Apache License 2.0 | 4 votes |
public static OutputType fromProcessOutputKey(Key outputKey) { return outputKey == ProcessOutputTypes.STDERR ? ERROR : NORMAL; }
Example 11
Source File: TestExecutionState.java From buck with Apache License 2.0 | 4 votes |
private ProcessHandler runBuildCommand(Executor executor) { final BuckModule buckModule = mProject.getComponent(BuckModule.class); final String targets = mConfiguration.data.targets; final String additionalParams = mConfiguration.data.additionalParams; final String testSelectors = mConfiguration.data.testSelectors; final String title = "Buck Test " + targets; buckModule.attach(targets); final BuckBuildCommandHandler handler = new BuckBuildCommandHandler(mProject, BuckCommand.TEST, /* doStartNotify */ false) { @Override protected void notifyLines(Key outputType, Iterable<String> lines) { super.notifyLines(outputType, lines); if (outputType != ProcessOutputTypes.STDERR) { return; } for (String line : lines) { final Matcher matcher = DEBUG_SUSPEND_PATTERN.matcher(line); if (matcher.find()) { final String port = matcher.group(1); attachDebugger(title, port); } } } }; if (!targets.isEmpty()) { List<String> params = Splitter.on(CharMatcher.whitespace()) .trimResults() .omitEmptyStrings() .splitToList(targets); handler.command().addParameters(params); } if (!testSelectors.isEmpty()) { handler.command().addParameter("--test-selectors"); handler.command().addParameter(testSelectors); } if (!additionalParams.isEmpty()) { for (String param : additionalParams.split("\\s")) { handler.command().addParameter(param); } } if (executor.getId().equals(DefaultDebugExecutor.EXECUTOR_ID)) { handler.command().addParameter("--debug"); } handler.start(); final OSProcessHandler result = handler.getHandler(); schedulePostExecutionActions(result, title); return result; }
Example 12
Source File: NativeFileWatcherImpl.java From consulo with Apache License 2.0 | 4 votes |
@Override public void notifyTextAvailable(@Nonnull String line, @Nonnull Key outputType) { if (outputType == ProcessOutputTypes.STDERR) { LOG.warn(line); } if (outputType != ProcessOutputTypes.STDOUT) { return; } if (LOG.isTraceEnabled()) LOG.trace(">> " + line); if (myLastOp == null) { WatcherOp watcherOp; try { watcherOp = WatcherOp.valueOf(line); } catch (IllegalArgumentException e) { String message = "Illegal watcher command: '" + line + "'"; if (line.length() <= 20) message += " " + Arrays.toString(line.chars().toArray()); LOG.error(message); return; } if (watcherOp == WatcherOp.GIVEUP) { notifyOnFailure(ApplicationBundle.message("watcher.gave.up"), null); myIsShuttingDown = true; } else if (watcherOp == WatcherOp.RESET) { myNotificationSink.notifyReset(null); } else { myLastOp = watcherOp; } } else if (myLastOp == WatcherOp.MESSAGE) { LOG.warn(line); notifyOnFailure(line, NotificationListener.URL_OPENING_LISTENER); myLastOp = null; } else if (myLastOp == WatcherOp.REMAP || myLastOp == WatcherOp.UNWATCHEABLE) { if ("#".equals(line)) { if (myLastOp == WatcherOp.REMAP) { processRemap(); } else { mySettingRoots.decrementAndGet(); processUnwatchable(); } myLines.clear(); myLastOp = null; } else { myLines.add(line); } } else { String path = StringUtil.trimEnd(line.replace('\0', '\n'), File.separator); // unescape processChange(path, myLastOp); myLastOp = null; } }
Example 13
Source File: LogConsolePreferences.java From consulo with Apache License 2.0 | 4 votes |
public static Key getProcessOutputTypes(String type) { if (type.equals(ERROR)) return ProcessOutputTypes.STDERR; if (type.equals(WARNING) || type.equals(INFO) || type.equals(DEBUG)) return ProcessOutputTypes.STDOUT; return null; }