ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntikho...@apache.org
Subject [15/29] ignite git commit: IGNITE-5987 Added -nq (visor will not quit in batch mode) option for Visor Cmd. (cherry picked from commit 8d6e842)
Date Tue, 15 Aug 2017 18:00:16 GMT
IGNITE-5987 Added -nq (visor will not quit in batch mode) option for Visor Cmd.
(cherry picked from commit 8d6e842)


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

Branch: refs/heads/ignite-5947
Commit: 841db65e56063605475710bc170de4aea672c31d
Parents: 580b6aa
Author: Alexey Kuznetsov <akuznetsov@apache.org>
Authored: Wed Aug 9 18:55:04 2017 +0700
Committer: Alexey Kuznetsov <akuznetsov@apache.org>
Committed: Wed Aug 9 18:56:14 2017 +0700

----------------------------------------------------------------------
 .../org/apache/ignite/visor/commands/VisorConsole.scala | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/841db65e/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 19d130e..d53a0d5 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
@@ -92,6 +92,7 @@ class VisorConsole {
             println("        -cfg=<path>          - connect with specified configuration.")
             println("        -b=<path>            - batch mode with file.")
             println("        -e=cmd1;cmd2;...     - batch mode with commands.")
+            println("        -nq                  - batch mode will not quit after execution
(useful for alerts monitoring).")
 
             visor.quit()
         }
@@ -103,6 +104,10 @@ class VisorConsole {
         val cfgFile = argValue("cfg", argLst)
         val batchFile = argValue("b", argLst)
         val batchCommand = argValue("e", argLst)
+        val noBatchQuit = hasArgName("nq", argLst)
+
+        if (noBatchQuit && batchFile.isEmpty && batchCommand.isEmpty)
+            visor.warn("Option \"-nq\" will be ignored because batch mode options \"-b\"
or \"-e\" were not specified.")
 
         cfgFile.foreach(cfg => {
             if (cfg.trim.isEmpty) {
@@ -149,7 +154,10 @@ class VisorConsole {
             case Some(cmd) =>
                 visor.batchMode = true
 
-                new ByteArrayInputStream((cmd + "\nquit\n").getBytes("UTF-8"))
+                val script = if (noBatchQuit) cmd else cmd + "\nquit\n"
+
+                new ByteArrayInputStream(script.getBytes("UTF-8"))
+
             case None => new FileInputStream(FileDescriptor.in)
         }
 
@@ -159,7 +167,7 @@ class VisorConsole {
 
             new TerminalSupport(false) {}
         } catch {
-            case ignored: ClassNotFoundException => null
+            case _: ClassNotFoundException => null
         }
 
         val reader = new ConsoleReader(inputStream, System.out, term)


Mime
View raw message