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-queryserver.git


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

commit a3bcfeec305b296d87d5a68dc8f6a1830406e63c
Author: Istvan Toth <st...@cloudera.com>
AuthorDate: Tue Aug 27 16:04:10 2019 +0200

    PHOENIX-5454 scripts start foreground java processes as child processes
    
    use os.exec*() in python scripts to start foreground java processes
---
 bin/psql.py         | 3 +--
 bin/queryserver.py  | 5 ++---
 bin/sqlline-thin.py | 3 +--
 3 files changed, 4 insertions(+), 7 deletions(-)

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 0c07b3b..5ca99a4 100755
--- a/bin/queryserver.py
+++ b/bin/queryserver.py
@@ -202,6 +202,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)

Reply via email to