Search in sources :

Example 1 with PtyCommandLine

use of com.intellij.execution.configurations.PtyCommandLine in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoExecutor method createCommandLine.

@NotNull
public GeneralCommandLine createCommandLine() throws ExecutionException {
    if (myGoRoot == null) {
        throw new ExecutionException("Sdk is not set or Sdk home path is empty for module");
    }
    GeneralCommandLine commandLine = !myPtyDisabled && PtyCommandLine.isEnabled() ? new PtyCommandLine() : new GeneralCommandLine();
    commandLine.setExePath(ObjectUtils.notNull(myExePath, GoSdkService.getGoExecutablePath(myGoRoot)));
    commandLine.getEnvironment().putAll(myExtraEnvironment);
    commandLine.getEnvironment().put(GoConstants.GO_ROOT, StringUtil.notNullize(myGoRoot));
    commandLine.getEnvironment().put(GoConstants.GO_PATH, StringUtil.notNullize(myGoPath));
    if (myVendoringEnabled != null) {
        commandLine.getEnvironment().put(GoConstants.GO_VENDORING_EXPERIMENT, myVendoringEnabled ? "1" : "0");
    }
    Collection<String> paths = ContainerUtil.newArrayList();
    ContainerUtil.addIfNotNull(paths, StringUtil.nullize(commandLine.getEnvironment().get(GoConstants.PATH), true));
    ContainerUtil.addIfNotNull(paths, StringUtil.nullize(EnvironmentUtil.getValue(GoConstants.PATH), true));
    ContainerUtil.addIfNotNull(paths, StringUtil.nullize(myEnvPath, true));
    commandLine.getEnvironment().put(GoConstants.PATH, StringUtil.join(paths, File.pathSeparator));
    commandLine.withWorkDirectory(myWorkDirectory);
    commandLine.addParameters(myParameterList.getList());
    commandLine.withParentEnvironmentType(myParentEnvironmentType);
    commandLine.withCharset(CharsetToolkit.UTF8_CHARSET);
    return commandLine;
}
Also used : GeneralCommandLine(com.intellij.execution.configurations.GeneralCommandLine) PtyCommandLine(com.intellij.execution.configurations.PtyCommandLine) ExecutionException(com.intellij.execution.ExecutionException) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ExecutionException (com.intellij.execution.ExecutionException)1 GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)1 PtyCommandLine (com.intellij.execution.configurations.PtyCommandLine)1 NotNull (org.jetbrains.annotations.NotNull)1