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

maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit a4179417310f16ede626db787f75c06a72504616
Author: Xing Guo <[email protected]>
AuthorDate: Tue Apr 26 14:15:21 2022 +0800

    Try to lookup commands by $PATH before iterating over hardcoded paths. 
(#13361)
    
    To my surprise, gp_bash_functions.sh finds available commands by
    iterating over hardcoded paths. This patch helps teach the script
    find commands by using the `which` command.
---
 gpMgmt/bin/lib/gp_bash_functions.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gpMgmt/bin/lib/gp_bash_functions.sh 
b/gpMgmt/bin/lib/gp_bash_functions.sh
index 9dcda93791..c0c2439187 100755
--- a/gpMgmt/bin/lib/gp_bash_functions.sh
+++ b/gpMgmt/bin/lib/gp_bash_functions.sh
@@ -40,6 +40,11 @@ GP_UNIQUE_COMMAND=gpstart
 findCmdInPath() {
                cmdtofind=$1
 
+               CMD=`which $cmdtofind`
+               if [ $? -eq 0 ]; then
+                               echo $CMD
+                               return
+               fi
                for pathel in ${CMDPATH[@]}
                                do
                                CMD=$pathel/$cmdtofind


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to