Repository: phoenix
Updated Branches:
  refs/heads/4.0 7b5716084 -> f5a49bff2


PHOENIX-897 Quote parameters in psql.py

Properly quote supplied command-line parameters in psql.py so that
it's possible to supply any character (including ones that have
special meanings in various shells) as parameters.


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/f5a49bff
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/f5a49bff
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/f5a49bff

Branch: refs/heads/4.0
Commit: f5a49bff2c43686fc0381f5262de75f504e366ed
Parents: 7b57160
Author: Gabriel Reid <gabri...@ngdata.com>
Authored: Mon Oct 27 10:57:43 2014 +0100
Committer: Gabriel Reid <gabri...@ngdata.com>
Committed: Mon Oct 27 10:57:43 2014 +0100

----------------------------------------------------------------------
 bin/psql.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/f5a49bff/bin/psql.py
----------------------------------------------------------------------
diff --git a/bin/psql.py b/bin/psql.py
index a8cbe31..34a95df 100755
--- a/bin/psql.py
+++ b/bin/psql.py
@@ -26,11 +26,17 @@ import phoenix_utils
 
 phoenix_utils.setPath()
 
+if os.name == 'nt':
+    args = subprocess.list2cmdline(sys.argv[1:])
+else:
+    import pipes    # pipes module isn't available on Windows
+    args = " ".join([pipes.quote(v) for v in sys.argv[1:]])
+
 # HBase configuration folder path (where hbase-site.xml reside) for
 # HBase/Phoenix client side property override
 java_cmd = 'java -cp "' + phoenix_utils.hbase_conf_path + os.pathsep + 
phoenix_utils.phoenix_client_jar + \
     '" -Dlog4j.configuration=file:' + \
     os.path.join(phoenix_utils.current_dir, "log4j.properties") + \
-    " org.apache.phoenix.util.PhoenixRuntime " + ' '.join(sys.argv[1:])
+    " org.apache.phoenix.util.PhoenixRuntime " + args 
 
 subprocess.call(java_cmd, shell=True)

Reply via email to