tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hj...@apache.org
Subject git commit: TAJO-1022: tsql does not work as background process
Date Thu, 11 Sep 2014 01:58:56 GMT
Repository: tajo
Updated Branches:
  refs/heads/master 016507dd6 -> 604eb3222


TAJO-1022: tsql does not work as background process

Closes #128


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/604eb322
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/604eb322
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/604eb322

Branch: refs/heads/master
Commit: 604eb32222d9bdfb4f6768a863472ec46776cb90
Parents: 016507d
Author: HyoungJun Kim <babokim@babokim-mbp.server.gruter.com>
Authored: Thu Sep 11 10:58:09 2014 +0900
Committer: HyoungJun Kim <babokim@babokim-mbp.server.gruter.com>
Committed: Thu Sep 11 10:58:09 2014 +0900

----------------------------------------------------------------------
 CHANGES                                         |  2 ++
 .../main/java/org/apache/tajo/cli/TajoCli.java  | 23 +++++++++++++-------
 2 files changed, 17 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/604eb322/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 285e45d..a36261b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -135,6 +135,8 @@ Release 0.9.0 - unreleased
 
   BUG FIXES
 
+    TAJO-1022: tsql does not work as background process(Hyoungjun Kim)
+
     TAJO-1029: TAJO_PULLSERVER_STANDALONE should be false in default tajo-env.sh
     (jinho)
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/604eb322/tajo-client/src/main/java/org/apache/tajo/cli/TajoCli.java
----------------------------------------------------------------------
diff --git a/tajo-client/src/main/java/org/apache/tajo/cli/TajoCli.java b/tajo-client/src/main/java/org/apache/tajo/cli/TajoCli.java
index 2f9e0b2..7c96e34 100644
--- a/tajo-client/src/main/java/org/apache/tajo/cli/TajoCli.java
+++ b/tajo-client/src/main/java/org/apache/tajo/cli/TajoCli.java
@@ -21,6 +21,9 @@ package org.apache.tajo.cli;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
 import com.google.protobuf.ServiceException;
+import jline.TerminalFactory;
+import jline.TerminalFactory.Flavor;
+import jline.UnsupportedTerminal;
 import jline.console.ConsoleReader;
 import org.apache.commons.cli.*;
 import org.apache.tajo.*;
@@ -39,10 +42,7 @@ import java.io.*;
 import java.lang.reflect.Constructor;
 import java.sql.ResultSet;
 import java.sql.SQLException;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
+import java.util.*;
 
 import static org.apache.tajo.cli.ParsedResult.StatementType.META;
 import static org.apache.tajo.cli.ParsedResult.StatementType.STATEMENT;
@@ -98,6 +98,7 @@ public class TajoCli {
     options.addOption("f", "file", true, "execute commands from file, then exit");
     options.addOption("h", "host", true, "Tajo server host");
     options.addOption("p", "port", true, "Tajo server port");
+    options.addOption("B", "background", false, "execute as background process");
     options.addOption("conf", "conf", true, "configuration value");
     options.addOption("param", "param", true, "parameter value in SQL file");
     options.addOption("help", "help", false, "help");
@@ -170,19 +171,25 @@ public class TajoCli {
   }
 
   public TajoCli(TajoConf c, String [] args, InputStream in, OutputStream out) throws Exception
{
+    CommandLineParser parser = new PosixParser();
+    CommandLine cmd = parser.parse(options, args);
+
     this.conf = new TajoConf(c);
     context = new TajoCliContext(conf);
     this.sin = in;
-    this.reader = new ConsoleReader(sin, out);
+    if (cmd.hasOption("B")) {
+      this.reader = new ConsoleReader(sin, out, new UnsupportedTerminal());
+    } else {
+      this.reader = new ConsoleReader(sin, out);
+    }
+
     this.reader.setExpandEvents(false);
     this.sout = new PrintWriter(reader.getOutput());
     initFormatter();
 
-    CommandLineParser parser = new PosixParser();
-    CommandLine cmd = parser.parse(options, args);
-
     if (cmd.hasOption("help")) {
       printUsage();
+      System.exit(0);
     }
 
     String hostName = null;


Mime
View raw message