mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Fix the repl when stdout is redirected.
The repl is sometimes failing to write anything to stdout when it is being redirected to a file (as in test/Interpreter/repl.swift). it looks like an editline bug on 10.8. explicitly fflushing stdout seems to help. Swift SVN r4669
This commit is contained in:
@@ -457,6 +457,13 @@ public:
|
|||||||
~REPLInput() {
|
~REPLInput() {
|
||||||
if (ShowColors)
|
if (ShowColors)
|
||||||
llvm::outs().resetColor();
|
llvm::outs().resetColor();
|
||||||
|
|
||||||
|
// FIXME: This should not be needed, but seems to help when stdout is being
|
||||||
|
// redirected to a file. Perhaps there is some underlying editline bug
|
||||||
|
// where it is setting stdout into some weird state and not restoring it
|
||||||
|
// with el_end?
|
||||||
|
llvm::outs().flush();
|
||||||
|
fflush(stdout);
|
||||||
el_end(e);
|
el_end(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -507,8 +514,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Enter the line into the line history.
|
// Enter the line into the line history.
|
||||||
// FIXME: We should probably be a bit more clever here about which lines we
|
// FIXME: We should probably be a bit more clever here about which lines
|
||||||
// put into the history and when we put them in.
|
// we put into the history and when we put them in.
|
||||||
HistEventW ev;
|
HistEventW ev;
|
||||||
history_w(h, &ev, H_ENTER, WLine);
|
history_w(h, &ev, H_ENTER, WLine);
|
||||||
|
|
||||||
@@ -576,7 +583,8 @@ private:
|
|||||||
|
|
||||||
if (ShowColors) {
|
if (ShowColors) {
|
||||||
const char *colorCode =
|
const char *colorCode =
|
||||||
llvm::sys::Process::OutputColor(llvm::raw_ostream::YELLOW, false, false);
|
llvm::sys::Process::OutputColor(llvm::raw_ostream::YELLOW,
|
||||||
|
false, false);
|
||||||
if (colorCode)
|
if (colorCode)
|
||||||
appendEscapeSequence(PromptString, colorCode);
|
appendEscapeSequence(PromptString, colorCode);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user