Java Code Examples for com.intellij.execution.configurations.GeneralCommandLine#setCharset()
The following examples show how to use
com.intellij.execution.configurations.GeneralCommandLine#setCharset() .
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: FlutterCommand.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Creates the command line to run. * <p> * If a project is supplied, it will be used to determine the ANDROID_HOME variable for the subprocess. */ @NotNull public GeneralCommandLine createGeneralCommandLine(@Nullable Project project) { final GeneralCommandLine line = new GeneralCommandLine(); line.setCharset(CharsetToolkit.UTF8_CHARSET); line.withEnvironment(FlutterSdkUtil.FLUTTER_HOST_ENV, FlutterSdkUtil.getFlutterHostEnvValue()); final String androidHome = IntelliJAndroidSdk.chooseAndroidHome(project, false); if (androidHome != null) { line.withEnvironment("ANDROID_HOME", androidHome); } line.setExePath(FileUtil.toSystemDependentName(sdk.getHomePath() + "/bin/" + FlutterSdkUtil.flutterScriptName())); if (workDir != null) { line.setWorkDirectory(workDir.getPath()); } if (!isDoctorCommand()) { line.addParameter("--no-color"); } line.addParameters(type.subCommand); line.addParameters(args); return line; }
Example 2
Source File: FlutterCommand.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Creates the command line to run. * <p> * If a project is supplied, it will be used to determine the ANDROID_HOME variable for the subprocess. */ @NotNull public GeneralCommandLine createGeneralCommandLine(@Nullable Project project) { final GeneralCommandLine line = new GeneralCommandLine(); line.setCharset(CharsetToolkit.UTF8_CHARSET); line.withEnvironment(FlutterSdkUtil.FLUTTER_HOST_ENV, FlutterSdkUtil.getFlutterHostEnvValue()); final String androidHome = IntelliJAndroidSdk.chooseAndroidHome(project, false); if (androidHome != null) { line.withEnvironment("ANDROID_HOME", androidHome); } line.setExePath(FileUtil.toSystemDependentName(sdk.getHomePath() + "/bin/" + FlutterSdkUtil.flutterScriptName())); if (workDir != null) { line.setWorkDirectory(workDir.getPath()); } if (!isDoctorCommand()) { line.addParameter("--no-color"); } line.addParameters(type.subCommand); line.addParameters(args); return line; }
Example 3
Source File: DevToolsManager.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Gets the process handler that will start DevTools in bazel. */ @Nullable private OSProcessHandler getProcessHandlerForBazel() { final WorkspaceCache workspaceCache = WorkspaceCache.getInstance(project); if (!workspaceCache.isBazel()) { return null; } final Workspace workspace = workspaceCache.get(); assert (workspace != null); if (workspace.getDevtoolsScript() == null) { return null; } final GeneralCommandLine commandLine = new GeneralCommandLine().withWorkDirectory(workspace.getRoot().getPath()); commandLine.setExePath(FileUtil.toSystemDependentName(workspace.getRoot().getPath() + "/" + workspace.getLaunchScript())); commandLine.setCharset(CharsetToolkit.UTF8_CHARSET); commandLine.addParameters(workspace.getDevtoolsScript(), "--", "--machine", "--port=0"); OSProcessHandler handler; try { handler = new MostlySilentOsProcessHandler(commandLine); } catch (ExecutionException e) { FlutterUtils.warn(LOG, e); handler = null; } if (handler != null) { FlutterConsoles.displayProcessLater(handler, project, null, handler::startNotify); } return handler; }
Example 4
Source File: DeviceDaemon.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
private GeneralCommandLine toCommandLine() { final GeneralCommandLine result = new GeneralCommandLine().withWorkDirectory(workDir); result.setCharset(CharsetToolkit.UTF8_CHARSET); result.setExePath(FileUtil.toSystemDependentName(command)); result.withEnvironment(FlutterSdkUtil.FLUTTER_HOST_ENV, FlutterSdkUtil.getFlutterHostEnvValue()); if (androidHome != null) { result.withEnvironment("ANDROID_HOME", androidHome); } for (String param : parameters) { result.addParameter(param); } return result; }
Example 5
Source File: DevToolsManager.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Gets the process handler that will start DevTools in bazel. */ @Nullable private OSProcessHandler getProcessHandlerForBazel() { final WorkspaceCache workspaceCache = WorkspaceCache.getInstance(project); if (!workspaceCache.isBazel()) { return null; } final Workspace workspace = workspaceCache.get(); assert (workspace != null); if (workspace.getDevtoolsScript() == null) { return null; } final GeneralCommandLine commandLine = new GeneralCommandLine().withWorkDirectory(workspace.getRoot().getPath()); commandLine.setExePath(FileUtil.toSystemDependentName(workspace.getRoot().getPath() + "/" + workspace.getLaunchScript())); commandLine.setCharset(CharsetToolkit.UTF8_CHARSET); commandLine.addParameters(workspace.getDevtoolsScript(), "--", "--machine", "--port=0"); OSProcessHandler handler; try { handler = new MostlySilentOsProcessHandler(commandLine); } catch (ExecutionException e) { FlutterUtils.warn(LOG, e); handler = null; } if (handler != null) { FlutterConsoles.displayProcessLater(handler, project, null, handler::startNotify); } return handler; }
Example 6
Source File: DeviceDaemon.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
private GeneralCommandLine toCommandLine() { final GeneralCommandLine result = new GeneralCommandLine().withWorkDirectory(workDir); result.setCharset(CharsetToolkit.UTF8_CHARSET); result.setExePath(FileUtil.toSystemDependentName(command)); result.withEnvironment(FlutterSdkUtil.FLUTTER_HOST_ENV, FlutterSdkUtil.getFlutterHostEnvValue()); if (androidHome != null) { result.withEnvironment("ANDROID_HOME", androidHome); } for (String param : parameters) { result.addParameter(param); } return result; }
Example 7
Source File: ExecutableValidator.java From consulo with Apache License 2.0 | 5 votes |
protected static boolean doCheckExecutable(@Nonnull String executable, @Nonnull List<String> processParameters) { try { GeneralCommandLine commandLine = new GeneralCommandLine(); commandLine.setExePath(executable); commandLine.addParameters(processParameters); commandLine.setCharset(CharsetToolkit.getDefaultSystemCharset()); CapturingProcessHandler handler = new CapturingProcessHandler(commandLine); ProcessOutput result = handler.runProcess(TIMEOUT_MS); boolean timeout = result.isTimeout(); int exitCode = result.getExitCode(); String stderr = result.getStderr(); if (timeout) { LOG.warn("Validation of " + executable + " failed with a timeout"); } if (exitCode != 0) { LOG.warn("Validation of " + executable + " failed with a non-zero exit code: " + exitCode); } if (!stderr.isEmpty()) { LOG.warn("Validation of " + executable + " failed with a non-empty error output: " + stderr); } return !timeout && exitCode == 0 && stderr.isEmpty(); } catch (Throwable t) { LOG.warn(t); return false; } }
Example 8
Source File: RNPathUtil.java From react-native-console with BSD 3-Clause "New" or "Revised" License | 4 votes |
public static GeneralCommandLine cmdToGeneralCommandLine(String cmd) { GeneralCommandLine commandLine = new GeneralCommandLine(cmd.split(" ")); commandLine.setCharset(Charset.forName("UTF-8")); return commandLine; }