You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2021/02/09 02:16:29 UTC
[iotdb] branch master updated: Enhancement: add backgroup exec for
cli -e function (#2658)
This is an automated email from the ASF dual-hosted git repository.
qiaojialin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 11edabd Enhancement: add backgroup exec for cli -e function (#2658)
11edabd is described below
commit 11edabdb70398d8e6cfb46215e735b525ee2f5f7
Author: gwmh <16...@qq.com>
AuthorDate: Tue Feb 9 10:16:06 2021 +0800
Enhancement: add backgroup exec for cli -e function (#2658)
---
cli/src/main/java/org/apache/iotdb/cli/Cli.java | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/cli/src/main/java/org/apache/iotdb/cli/Cli.java b/cli/src/main/java/org/apache/iotdb/cli/Cli.java
index abcd8de..98a7f8e 100644
--- a/cli/src/main/java/org/apache/iotdb/cli/Cli.java
+++ b/cli/src/main/java/org/apache/iotdb/cli/Cli.java
@@ -108,18 +108,13 @@ public class Cli extends AbstractCli {
}
private static void serve() {
- try (ConsoleReader reader = new ConsoleReader()) {
- reader.setExpandEvents(false);
-
+ try {
host = checkRequiredArg(HOST_ARGS, HOST_NAME, commandLine, false, host);
port = checkRequiredArg(PORT_ARGS, PORT_NAME, commandLine, false, port);
username = checkRequiredArg(USERNAME_ARGS, USERNAME_NAME, commandLine, true, null);
password = commandLine.getOptionValue(PASSWORD_ARGS);
- if (password == null) {
- password = reader.readLine("please input your password:", '\0');
- }
- if (hasExecuteSQL) {
+ if (hasExecuteSQL && password != null) {
try (IoTDBConnection connection = (IoTDBConnection) DriverManager
.getConnection(Config.IOTDB_URL_PREFIX + host + ":" + port + "/", username, password)) {
properties = connection.getServerProperties();
@@ -130,8 +125,13 @@ public class Cli extends AbstractCli {
println(IOTDB_CLI_PREFIX + "> can't execute sql because" + e.getMessage());
}
}
-
- receiveCommands(reader);
+ try (ConsoleReader reader = new ConsoleReader()) {
+ reader.setExpandEvents(false);
+ if (password == null) {
+ password = reader.readLine("please input your password:", '\0');
+ }
+ receiveCommands(reader);
+ }
} catch (ArgsErrorException e) {
println(IOTDB_CLI_PREFIX + "> input params error because" + e.getMessage());
} catch (Exception e) {