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

stoty pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/master by this push:
     new 6405839  PHOENIX-5454 scripts start foreground java processes as child 
processes
6405839 is described below

commit 6405839b60c410292c0e2c8cbbdee55d09343bab
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/sqlline.py          | 9 +--------
 bin/traceserver.py      | 4 ++--
 6 files changed, 7 insertions(+), 18 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/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)

Reply via email to