diff --git a/META-INF/plugin.xml b/META-INF/plugin.xml index d74e566..5110d22 100644 --- a/META-INF/plugin.xml +++ b/META-INF/plugin.xml @@ -1,7 +1,7 @@ org.turbanov.execution.cmd RunInCmd - 1.7 + 1.8 Turbanov Andrey --> 1.8 +
    +
  • Fix IllegalStateException in IntelliJ IDEA 2020.1
  • +
  • Fix run inside IDEA terminal
  • +

1.7

  • Update to support IntelliJ IDEA 2019.x
  • @@ -70,14 +75,6 @@ - - - - - - - - diff --git a/README.md b/README.md index 6d30fd0..6a6a8d6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # RunInCmdPlugin -Plugin for IntelliJ IDEA. It allows to run your RunConfiguration inside cmd.exe instead of internal IDEA console -Also it provides ability to modify program and VM options on-the-fly before run +Plugin for IntelliJ IDEA. It allows to run your RunConfiguration inside cmd.exe instead of internal IDEA console. +Also it provides ability to modify a program and VM options on-the-fly before run. # Repository link https://plugins.jetbrains.com/plugin/7976-runincmd diff --git a/META-INF/terminal.plugin.support.xml b/resources/META-INF/terminal.plugin.support.xml similarity index 100% rename from META-INF/terminal.plugin.support.xml rename to resources/META-INF/terminal.plugin.support.xml diff --git a/src/org/turbanov/execution/cmd/InCmdRunner.java b/src/org/turbanov/execution/cmd/InCmdRunner.java index 11b67f8..9db64c3 100644 --- a/src/org/turbanov/execution/cmd/InCmdRunner.java +++ b/src/org/turbanov/execution/cmd/InCmdRunner.java @@ -75,8 +75,10 @@ protected RunContentDescriptor doExecute(@NotNull RunProfileState runProfileStat JavaCommandLineState state = (JavaCommandLineState) runProfileState; JavaParameters javaParameters = state.getJavaParameters(); javaParameters.setUseDynamicClasspath(false); - GeneralCommandLine oldCommandLine = javaParameters.toCommandLine(); - LOG.info("Old command line: " + oldCommandLine); + LOG.info("Old command line. JDK path: " + javaParameters.getJdkPath() + + " VM options: " + javaParameters.getVMParametersList() + + " Parameters: " + javaParameters.getProgramParametersList() + ); OptionsPatchConfiguration options = ServiceManager.getService(environment.getProject(), OptionsPatchConfiguration.class); patchParameterList(javaParameters.getVMParametersList(), options.toAddVmOptions, options.toRemoveVmOptions, options.startPort); diff --git a/src/org/turbanov/execution/cmd/TerminalRunner.java b/src/org/turbanov/execution/cmd/TerminalRunner.java index 7bd06e2..6f57011 100644 --- a/src/org/turbanov/execution/cmd/TerminalRunner.java +++ b/src/org/turbanov/execution/cmd/TerminalRunner.java @@ -3,8 +3,10 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.terminal.LocalTerminalDirectRunner; +import org.jetbrains.plugins.terminal.TerminalProcessOptions; import org.jetbrains.plugins.terminal.TerminalView; import com.intellij.openapi.project.Project; +import com.intellij.terminal.JBTerminalWidget; import com.pty4j.PtyProcess; import java.io.IOException; @@ -21,15 +23,25 @@ public static void runInIdeaTerminal(@NotNull Project project, @NotNull String[] LocalTerminalDirectRunner runner = new LocalTerminalDirectRunner(project) { @Override protected PtyProcess createProcess(@Nullable String directory, @Nullable String commandHistoryFilePath) throws ExecutionException { - Map envs = new HashMap<>(System.getenv()); - envs.put("CLASSPATH", classPath); - try { - return PtyProcess.exec(command, envs, workingDirectory); - } catch (IOException e) { - throw new ExecutionException(e); - } + return createProcessImpl(classPath, command, workingDirectory); + } + + + @Override + public @NotNull PtyProcess createProcess(@NotNull TerminalProcessOptions options, @Nullable JBTerminalWidget widget) throws ExecutionException { + return createProcessImpl(classPath, command, workingDirectory); } }; terminalView.createNewSession(runner); } + + private static PtyProcess createProcessImpl(@NotNull String classPath, @NotNull String[] command, @NotNull String workingDirectory) throws ExecutionException { + Map envs = new HashMap<>(System.getenv()); + envs.put("CLASSPATH", classPath); + try { + return PtyProcess.exec(command, envs, workingDirectory); + } catch (IOException e) { + throw new ExecutionException(e); + } + } }