This is an automated email from the ASF dual-hosted git repository.

haonan 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 ebf52326b68 change cli classpath (#12237)
ebf52326b68 is described below

commit ebf52326b684c7bfeb153667871d5bc66de3affa
Author: CritasWang <[email protected]>
AuthorDate: Wed Mar 27 11:14:49 2024 +0800

    change cli classpath (#12237)
---
 .../java/org/apache/iotdb/cli/it/StartClientScriptIT.java     | 11 +++++++----
 iotdb-client/cli/src/assembly/resources/sbin/start-cli.sh     |  4 +---
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git 
a/integration-test/src/test/java/org/apache/iotdb/cli/it/StartClientScriptIT.java
 
b/integration-test/src/test/java/org/apache/iotdb/cli/it/StartClientScriptIT.java
index 5e3f5bcee32..7f9a2328929 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/cli/it/StartClientScriptIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/cli/it/StartClientScriptIT.java
@@ -45,6 +45,8 @@ public class StartClientScriptIT extends AbstractScript {
 
   private static String libPath;
 
+  private static String homePath;
+
   @BeforeClass
   public static void setUp() throws Exception {
     EnvFactory.getEnv().initClusterEnvironment();
@@ -52,6 +54,8 @@ public class StartClientScriptIT extends AbstractScript {
     port = EnvFactory.getEnv().getPort();
     sbinPath = EnvFactory.getEnv().getSbinPath();
     libPath = EnvFactory.getEnv().getLibPath();
+    homePath =
+        libPath.substring(0, libPath.lastIndexOf(File.separator + "lib" + 
File.separator + "*"));
   }
 
   @AfterClass
@@ -71,8 +75,6 @@ public class StartClientScriptIT extends AbstractScript {
 
   @Override
   protected void testOnWindows() throws IOException {
-    final String homePath =
-        libPath.substring(0, libPath.lastIndexOf(File.separator + "lib" + 
File.separator + "*"));
 
     final String[] output = {
       "Error: Connection Error, please check whether the network is available 
or the server has started. Host is 127.0.0.1, port is 6668."
@@ -117,6 +119,7 @@ public class StartClientScriptIT extends AbstractScript {
 
   @Override
   protected void testOnUnix() throws IOException {
+
     final String[] output = {
       "Error: Connection Error, please check whether the network is available 
or the server has started. Host is 127.0.0.1, port is 6668."
     };
@@ -132,7 +135,7 @@ public class StartClientScriptIT extends AbstractScript {
             "root",
             "-pw",
             "root");
-    builder.environment().put("CLASSPATH", libPath);
+    builder.environment().put("IOTDB_HOME", homePath);
     testOutput(builder, output, 1);
 
     final String[] output2 = {"Msg: The statement is executed successfully."};
@@ -146,7 +149,7 @@ public class StartClientScriptIT extends AbstractScript {
             port,
             "-e",
             "\"flush\"");
-    builder2.environment().put("CLASSPATH", libPath);
+    builder2.environment().put("IOTDB_HOME", homePath);
     testOutput(builder2, output2, 0);
   }
 }
diff --git a/iotdb-client/cli/src/assembly/resources/sbin/start-cli.sh 
b/iotdb-client/cli/src/assembly/resources/sbin/start-cli.sh
index f6a91db3565..0e5f7d92c88 100755
--- a/iotdb-client/cli/src/assembly/resources/sbin/start-cli.sh
+++ b/iotdb-client/cli/src/assembly/resources/sbin/start-cli.sh
@@ -110,9 +110,7 @@ IOTDB_CLI_CONF=${IOTDB_HOME}/conf
 
 MAIN_CLASS=org.apache.iotdb.cli.Cli
 
-for f in ${IOTDB_HOME}/lib/*.jar; do
-  CLASSPATH=${CLASSPATH}":"$f
-done
+CLASSPATH=${IOTDB_HOME}/lib/*
 
 
 if [ -n "$JAVA_HOME" ]; then

Reply via email to