From 6a73ff84ae8e0c2a1accb38bb788b3f63bce1866 Mon Sep 17 00:00:00 2001 From: Konstantin Kolosovsky Date: Thu, 7 Apr 2016 20:11:10 +0300 Subject: [PATCH] IDEA-153533 Fixed svn output reading in Windows in interactive mode --- .../svn/commandLine/WinTerminalProcessHandler.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/WinTerminalProcessHandler.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/WinTerminalProcessHandler.java index c10bac2e818b..a578fe1fe32e 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/WinTerminalProcessHandler.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/WinTerminalProcessHandler.java @@ -17,6 +17,7 @@ package org.jetbrains.idea.svn.commandLine; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.text.StringUtil; +import com.intellij.util.io.BaseDataReader; import org.jetbrains.annotations.NotNull; /** @@ -37,6 +38,19 @@ public class WinTerminalProcessHandler extends TerminalProcessHandler { return true; } + @NotNull + @Override + protected BaseDataReader createOutputDataReader(@NotNull BaseDataReader.SleepingPolicy sleepingPolicy) { + // Currently, when blocking policy is used, reading stops when nothing was actually read (stream ended). + // This is an issue for reading output in Windows as redirection to file is used. And so file is actually + // empty when first read attempt is performed (thus no output is read at all). + // So here we ensure non-blocking policy is used for such cases. + sleepingPolicy = + useAdaptiveSleepingPolicyWhenReadingOutput() ? new BaseDataReader.AdaptiveSleepingPolicy() : BaseDataReader.SleepingPolicy.SIMPLE; + + return super.createOutputDataReader(sleepingPolicy); + } + @NotNull @Override protected String filterCombinedText(@NotNull String currentLine) {