ShellcheckResponse (@NotNull CollectedInfo fileInfo) { // Temporary solution to avoid execution under read action in dumb mode. Should be removed after IDEA-229905 will be fixed Application application = ApplicationManager.getApplication(); if (application != null && application.isReadAccessAllowed() && !application.isUnitTestMode()) return null; String shellcheckExecutable = ShSettings.getShellcheckPath(); if (!ShShellcheckUtil.isExecutionValidPath(shellcheckExecutable)) return null; ShShellcheckUtil.checkShellCheckForUpdate(fileInfo.project); try { GeneralCommandLine commandLine = new GeneralCommandLine() .withParentEnvironmentType(GeneralCommandLine.ParentEnvironmentType.CONSOLE) .withExePath(shellcheckExecutable) .withParameters(fileInfo.executionParams); if (!ApplicationManager.getApplication().isUnitTestMode()) commandLine.withWorkDirectory(fileInfo.workDirectory); long timestamp = fileInfo.modificationStamp; OSProcessHandler handler = new OSProcessHandler(commandLine); Ref<ShellcheckResponse> response = Ref.create(); handler.addProcessListener(new CapturingProcessAdapter() { @Override public void processTerminated(@NotNull ProcessEvent event) { // The process ends up with code 1 Type type = TypeToken.getParameterized(List.class, Result.class).getType(); Collection<Result> results = new Gson().fromJson(getOutput().getStdout(), type); if (results != null) response.set(new ShellcheckResponse(results, timestamp)); } }); handler.startNotify(); writeFileContentToStdin(handler.getProcess(), fileInfo.fileContent, commandLine.getCharset()); if (!handler.waitFor(TIMEOUT_IN_MILLISECONDS)) { LOG.debug("Execution timeout, process will be forcibly terminated"); handler.destroyProcess(); } return response.get(); } catch (ExecutionException e) { LOG.error(e); return null; } }