Permalink
Browse files

Merged fix for GRAILS-8979

  • Loading branch information...
1 parent a69923a commit 9a37675f3f32497db8a0a73ea822ccd64f1bebfb @graemerocher graemerocher committed Apr 2, 2012
Showing with 10 additions and 13 deletions.
  1. +10 −13 grails-bootstrap/src/main/groovy/grails/build/logging/GrailsConsole.java
@@ -119,23 +119,23 @@ public String toString() {
protected GrailsConsole() throws IOException {
cursorMove = 1;
+ out = new PrintStream(ansiWrap(System.out));
+
+ System.setOut(new GrailsConsolePrintStream(out));
+ System.setErr(new GrailsConsoleErrorPrintStream(ansiWrap(System.err)));
if(isInteractiveEnabled()) {
reader = createConsoleReader();
reader.setBellEnabled(false);
reader.setCompletionHandler(new CandidateListCompletionHandler());
+ if(isActivateTerminal()) {
+ terminal = createTerminal();
+ }
}
-
- if(isActivateTerminal()) {
+ else if(isActivateTerminal()) {
terminal = createTerminal();
}
- out = new PrintStream(ansiWrap(System.out));
-
- System.setOut(new GrailsConsolePrintStream(out));
- System.setErr(new GrailsConsoleErrorPrintStream(ansiWrap(System.err)));
-
-
// bit of a WTF this, but see no other way to allow a customization indicator
maxIndicatorString = new StringBuilder(indicator).append(indicator).append(indicator).append(indicator).append(indicator);
@@ -159,7 +159,7 @@ private boolean readPropOrTrue(String prop) {
}
protected ConsoleReader createConsoleReader() throws IOException {
- return new ConsoleReader();
+ return new ConsoleReader(System.in, new OutputStreamWriter(out));
}
/**
@@ -197,10 +197,7 @@ public boolean isANSISupported() {
* handle it and the wrapped stream will not pass the ansi chars on to Eclipse).
*/
protected OutputStream ansiWrap(@SuppressWarnings("hiding") OutputStream out) {
- if(isAnsiEnabled())
- return AnsiConsole.wrapOutputStream(out);
- else
- return out;
+ return AnsiConsole.wrapOutputStream(out);
}
// hack to workaround JLine bug - see https://issues.apache.org/jira/browse/GERONIMO-3978 for source of fix

0 comments on commit 9a37675

Please sign in to comment.