ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [09/50] incubator-ignite git commit: # ignite-gg-9830 Fixed read.
Date Wed, 29 Apr 2015 13:14:29 GMT
# ignite-gg-9830 Fixed read.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/6389aef9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/6389aef9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/6389aef9

Branch: refs/heads/ignite-786
Commit: 6389aef9d0f8236e4d7c3e7ad890aba3e57b6ce7
Parents: 97b19ca
Author: Andrey <anovikov@gridgain.com>
Authored: Tue Apr 28 11:28:33 2015 +0700
Committer: Andrey <anovikov@gridgain.com>
Committed: Tue Apr 28 11:28:33 2015 +0700

----------------------------------------------------------------------
 .../ignite/visor/commands/VisorConsole.scala       |  6 +++---
 .../main/scala/org/apache/ignite/visor/visor.scala | 17 ++++++++++++++---
 2 files changed, 17 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6389aef9/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
index cc4d904..d4ac39d 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
@@ -305,9 +305,9 @@ object VisorConsole extends VisorConsole with App {
     
     private val reader = buildReader(argLst)
 
-    scala.Console.withIn(reader.getInput) {
-        mainLoop(reader)
-    }
+    visor.reader(reader)
+
+    mainLoop(reader)
 }
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6389aef9/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
index 0336ae8..3587f5a 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala
@@ -37,6 +37,7 @@ import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi
 import org.apache.ignite.thread.IgniteThreadPoolExecutor
 import org.apache.ignite.visor.commands.common.VisorTextTable
 
+import jline.console.ConsoleReader
 import org.jetbrains.annotations.Nullable
 
 import java.io._
@@ -54,7 +55,6 @@ import org.apache.ignite.internal.visor.{VisorMultiNodeTask, VisorTaskArgument}
 
 import scala.collection.JavaConversions._
 import scala.collection.immutable
-import scala.io.StdIn._
 import scala.language.{implicitConversions, reflectiveCalls}
 import scala.util.control.Breaks._
 
@@ -236,6 +236,14 @@ object visor extends VisorTag {
     /** */
     @volatile var ignite: IgniteEx = null
 
+    private var reader: ConsoleReader = null
+
+    def reader(reader: ConsoleReader) {
+        assert(reader != null)
+
+        this.reader = reader
+    }
+
     /**
      * Get grid node for specified ID.
      *
@@ -2187,13 +2195,16 @@ object visor extends VisorTag {
      * @param prompt User prompt.
      * @param mask Mask character (if `None`, no masking will be applied).
      */
-    private def readLineOpt(prompt: String, mask: Option[Char] = None): Option[String] =
+    private def readLineOpt(prompt: String, mask: Option[Char] = None): Option[String] =
{
+        assert(reader != null)
+
         try {
-            Option(mask.fold(readLine(prompt))(readLine(prompt, _)))
+            Option(mask.fold(reader.readLine(prompt))(reader.readLine(prompt, _)))
         }
         catch {
             case _: Throwable => None
         }
+    }
 
     /**
      * Asks user to choose node id8.


Mime
View raw message