Add possibility for flavor to patch command line before execution (https://github...
[idea/community.git] / python / src / com / jetbrains / python / sdk / PySdkUtil.java
index 48210bbd82e7634d58591b523f406d51ecb36359..1a38fd9b7c10064972f9975acc47f6dc9ec6d30a 100644 (file)
@@ -33,6 +33,8 @@ import com.intellij.psi.PsiFile;
 import com.intellij.remote.RemoteSdkAdditionalData;
 import com.intellij.util.SystemProperties;
 import com.intellij.util.containers.HashMap;
+import com.jetbrains.python.run.CommandLinePatcher;
+import com.jetbrains.python.sdk.flavors.PythonSdkFlavor;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
@@ -125,6 +127,14 @@ public class PySdkUtil {
     try {
 
       final GeneralCommandLine commandLine = cmd.withWorkDirectory(homePath).withEnvironment(env);
+
+      final PythonSdkFlavor flavor = PythonSdkFlavor.getFlavor(commandLine.getExePath());
+
+      final CommandLinePatcher cmdLinePatcher = flavor.commandLinePatcher();
+      if (cmdLinePatcher != null) {
+        cmdLinePatcher.patchCommandLine(cmd);
+      }
+
       final CapturingProcessHandler processHandler = new CapturingProcessHandler(commandLine);
       if (stdin != null) {
         final OutputStream processInput = processHandler.getProcessInput();