diff --git a/platform/platform-impl/src/com/intellij/execution/wsl/WSLUtil.java b/platform/platform-impl/src/com/intellij/execution/wsl/WSLUtil.java
index 95e6cbddd20e..5be9376d48a3 100644
--- a/platform/platform-impl/src/com/intellij/execution/wsl/WSLUtil.java
+++ b/platform/platform-impl/src/com/intellij/execution/wsl/WSLUtil.java
@@ -10,6 +10,7 @@ import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -122,10 +123,13 @@ public class WSLUtil {
* Temporary hack method to fix WSL bug
* Must be invoked just before execution, see RUBY-20358
*/
+ @ApiStatus.ScheduledForRemoval(inVersion = "2019.2")
@NotNull
public static T addInputCloseListener(@NotNull T processHandler) {
- processHandler.removeProcessListener(INPUT_CLOSE_LISTENER);
- processHandler.addProcessListener(INPUT_CLOSE_LISTENER);
+ if (Experiments.isFeatureEnabled("wsl.close.process.input")) {
+ processHandler.removeProcessListener(INPUT_CLOSE_LISTENER);
+ processHandler.addProcessListener(INPUT_CLOSE_LISTENER);
+ }
return processHandler;
}
diff --git a/platform/platform-resources/src/META-INF/PlatformExtensions.xml b/platform/platform-resources/src/META-INF/PlatformExtensions.xml
index d805ffc0ba46..aaec99c0bef2 100644
--- a/platform/platform-resources/src/META-INF/PlatformExtensions.xml
+++ b/platform/platform-resources/src/META-INF/PlatformExtensions.xml
@@ -13,6 +13,12 @@
+
+ Forces closing of WSL process input stream to prevent process zombification. See
+ https://github.com/Microsoft/WSL/issues/2592
+ Required for Windows 10 version prior 1803
+
+