void (@NotNull VirtualFile workDirectory, @NotNull String commandString, @NotNull Executor executor, @NotNull DataContext dataContext) { final Project project = CommonDataKeys.PROJECT.getData(dataContext); LOG.assertTrue(project != null); Collection<String> commands = RunAnythingCache.getInstance(project).getState().getCommands(); commands.remove(commandString); commands.add(commandString); dataContext = RunAnythingCommandCustomizer.customizeContext(dataContext); GeneralCommandLine initialCommandLine = new GeneralCommandLine(ParametersListUtil.parse(commandString, false, true)) .withParentEnvironmentType(GeneralCommandLine.ParentEnvironmentType.CONSOLE) .withWorkDirectory(workDirectory.getPath()); GeneralCommandLine commandLine = RunAnythingCommandCustomizer.customizeCommandLine(dataContext, workDirectory, initialCommandLine); try { RunAnythingRunProfile runAnythingRunProfile = new RunAnythingRunProfile( Registry.is("run.anything.use.pty", false) ? new PtyCommandLine(commandLine) : commandLine, commandString ); ExecutionEnvironmentBuilder.create(project, executor, runAnythingRunProfile) .dataContext(dataContext) .buildAndExecute(); } catch (ExecutionException e) { LOG.warn(e); Messages.showInfoMessage(project, e.getMessage(), IdeBundle.message("run.anything.console.error.title")); } }