You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by st...@apache.org on 2020/01/14 09:40:28 UTC

[phoenix] branch 4.x-HBase-1.5 updated: PHOENIX-5454 scripts start foreground java processes as child processes

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

stoty pushed a commit to branch 4.x-HBase-1.5
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/4.x-HBase-1.5 by this push:
     new d6eeb84  PHOENIX-5454 scripts start foreground java processes as child processes
d6eeb84 is described below

commit d6eeb840595b8fe0255bed2ece38b5c47bc77645
Author: Istvan Toth <st...@stoty.hu>
AuthorDate: Tue Aug 27 16:03:04 2019 +0200

    PHOENIX-5454 scripts start foreground java processes as child processes
    
    use os.exec*() in python scripts to start foreground java processes
---
 bin/end2endTest.py      | 3 +--
 bin/pherf-cluster.py    | 3 +--
 bin/pherf-standalone.py | 3 +--
 bin/psql.py             | 3 +--
 bin/queryserver.py      | 5 ++---
 bin/sqlline-thin.py     | 3 +--
 bin/sqlline.py          | 9 +--------
 bin/traceserver.py      | 4 ++--
 8 files changed, 10 insertions(+), 23 deletions(-)

diff --git a/bin/end2endTest.py b/bin/end2endTest.py
index 2e4b68e..32621f6 100755
--- a/bin/end2endTest.py
+++ b/bin/end2endTest.py
@@ -43,5 +43,4 @@ java_cmd = "java -cp " + phoenix_utils.hbase_conf_dir + os.pathsep + phoenix_jar
     hbase_library_path + " org.apache.phoenix.end2end.End2EndTestDriver " + \
     ' '.join(sys.argv[1:])
 
-exitcode = subprocess.call(java_cmd, shell=True)
-sys.exit(exitcode)
+os.execl("/bin/sh", "/bin/sh", "-c", java_cmd)
diff --git a/bin/pherf-cluster.py b/bin/pherf-cluster.py
index 37f29a8..031cfd9 100755
--- a/bin/pherf-cluster.py
+++ b/bin/pherf-cluster.py
@@ -79,5 +79,4 @@ java_cmd = java +' -cp "' + hbasecp + os.pathsep + phoenix_utils.pherf_conf_path
     os.path.join(phoenix_utils.current_dir, "log4j.properties") + \
     " org.apache.phoenix.pherf.Pherf " + args 
 
-exitcode = subprocess.call(java_cmd, shell=True)
-sys.exit(exitcode)
+os.execl("/bin/sh", "/bin/sh", "-c", java_cmd)
diff --git a/bin/pherf-standalone.py b/bin/pherf-standalone.py
index bac2337..b0d593e 100755
--- a/bin/pherf-standalone.py
+++ b/bin/pherf-standalone.py
@@ -67,5 +67,4 @@ java_cmd = java +' -Xms512m -Xmx3072m  -cp "' + phoenix_utils.pherf_conf_path +
     os.path.join(phoenix_utils.current_dir, "log4j.properties") + \
     " org.apache.phoenix.pherf.Pherf " + args 
 
-exitcode = subprocess.call(java_cmd, shell=True)
-sys.exit(exitcode)
+os.execl("/bin/sh", "/bin/sh", "-c", java_cmd)
diff --git a/bin/psql.py b/bin/psql.py
index 973d3de..2002cb3 100755
--- a/bin/psql.py
+++ b/bin/psql.py
@@ -68,5 +68,4 @@ java_cmd = java + ' $PHOENIX_OPTS ' + \
     os.path.join(phoenix_utils.current_dir, "log4j.properties") + \
     " org.apache.phoenix.util.PhoenixRuntime " + args 
 
-exitcode = subprocess.call(java_cmd, shell=True)
-sys.exit(exitcode)
+os.execl("/bin/sh", "/bin/sh", "-c", java_cmd)
diff --git a/bin/queryserver.py b/bin/queryserver.py
index 26d096c..11cfc1a 100755
--- a/bin/queryserver.py
+++ b/bin/queryserver.py
@@ -210,6 +210,5 @@ elif command == 'stop':
 else:
     # run in the foreground using defaults from log4j.properties
     cmd = java_cmd % {'java': java, 'root_logger': 'INFO,console', 'log_dir': '.', 'log_file': 'psql.log'}
-    # Because shell=True is not set, we don't have to alter the environment
-    child = subprocess.Popen(cmd.split())
-    sys.exit(child.wait())
+    splitcmd = cmd.split()
+    os.execvp(splitcmd[0], splitcmd)
diff --git a/bin/sqlline-thin.py b/bin/sqlline-thin.py
index fecc96c..f6f9ff1 100755
--- a/bin/sqlline-thin.py
+++ b/bin/sqlline-thin.py
@@ -171,5 +171,4 @@ java_cmd = java + ' $PHOENIX_OPTS ' + \
     " --color=" + colorSetting + " --fastConnect=" + args.fastconnect + " --verbose=" + args.verbose + \
     " --incremental=false --isolation=TRANSACTION_READ_COMMITTED " + sqlfile
 
-exitcode = subprocess.call(java_cmd, shell=True)
-sys.exit(exitcode)
+os.execl("/bin/sh", "/bin/sh", "-c", java_cmd)
diff --git a/bin/sqlline.py b/bin/sqlline.py
index 4a676ee..00c2d92 100755
--- a/bin/sqlline.py
+++ b/bin/sqlline.py
@@ -115,11 +115,4 @@ java_cmd = java + ' $PHOENIX_OPTS ' + \
     " -n none -p none --color=" + colorSetting + " --fastConnect=" + args.fastconnect + \
     " --verbose=" + args.verbose + " --incremental=false --isolation=TRANSACTION_READ_COMMITTED " + sqlfile
 
-childProc = subprocess.Popen(java_cmd, shell=True)
-#Wait for child process exit
-(output, error) = childProc.communicate()
-returncode = childProc.returncode
-childProc = None
-# Propagate Java return code to this script
-if returncode is not None:
-    sys.exit(returncode)
+os.execl("/bin/sh", "/bin/sh", "-c", java_cmd)
diff --git a/bin/traceserver.py b/bin/traceserver.py
index 62e168c..356009c 100755
--- a/bin/traceserver.py
+++ b/bin/traceserver.py
@@ -187,5 +187,5 @@ elif command == 'stop':
 else:
     # run in the foreground using defaults from log4j.properties
     cmd = java_cmd % {'java': java, 'root_logger': 'INFO,console', 'log_dir': '.', 'log_file': 'psql.log'}
-    child = subprocess.Popen(cmd.split())
-    sys.exit(child.wait())
+    splitcmd = cmd.split()
+    os.execvp(splitcmd[0], splitcmd)