mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-1409: Flush buffer after any user-specific message if stdin (aka 'editable')' is supported but do not flush it in the middle of TC message
* We have kind a buffer that needs to be flushed periodically. We need to flush it after new line, after any user output (because user may print something with out of new line and wait for input) but we shall not flush in in the middle of TC message because partially broken message is ignored. * According to IDEA-CR-16520: Anna's comment: "It looks like you don't want to flush if there is non-finished teamcity message. At least I would check all chunks if there is any with text starting with teamcity_message"
This commit is contained in:
+7
-3
@@ -101,7 +101,8 @@ public abstract class OutputLineSplitter {
|
||||
// we can safely flush buffer.
|
||||
|
||||
// TODO if editable:
|
||||
if (myStdinSupportEnabled && !isMostLikelyServiceMessagePart(text)) {
|
||||
if (myStdinSupportEnabled && !isInTeamcityMessage()) {
|
||||
// We should not flush in the middle of TC message because of [PY-7659]
|
||||
flushStdOutBuffer();
|
||||
}
|
||||
}
|
||||
@@ -150,8 +151,11 @@ public abstract class OutputLineSplitter {
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isMostLikelyServiceMessagePart(@NotNull final String text) {
|
||||
return text.startsWith(TEAMCITY_SERVICE_MESSAGE_PREFIX);
|
||||
/**
|
||||
* @return if current stdout cache contains part of TC message.
|
||||
*/
|
||||
protected boolean isInTeamcityMessage() {
|
||||
return myStdOutChunks.stream().anyMatch(chunk -> chunk.getText().startsWith(TEAMCITY_SERVICE_MESSAGE_PREFIX));
|
||||
}
|
||||
|
||||
protected abstract void onLineAvailable(@NotNull String text, @NotNull Key outputType, boolean tcLikeFakeOutput);
|
||||
|
||||
@@ -33,6 +33,9 @@ public class PythonTRunnerConsoleProperties extends SMTRunnerConsoleProperties {
|
||||
|
||||
private final boolean myIsEditable;
|
||||
|
||||
/**
|
||||
* @param editable if user should have ability to print something to test stdin
|
||||
*/
|
||||
public PythonTRunnerConsoleProperties(@NotNull ModuleRunConfiguration config, @NotNull Executor executor, boolean editable) {
|
||||
super(config, FRAMEWORK_NAME, executor);
|
||||
myIsEditable = editable;
|
||||
|
||||
Reference in New Issue
Block a user