From 88631d69b4d4c24c27d3d1e38485ae2f8d14849f Mon Sep 17 00:00:00 2001
From: Joe Garcia <joe.garcia@ssec.wisc.edu>
Date: Thu, 12 Sep 2024 15:53:46 -0500
Subject: [PATCH] use while read instead of xargs for functions needing bash -c

---
 ShellB3/shallbethree.sh | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/ShellB3/shallbethree.sh b/ShellB3/shallbethree.sh
index 75bf0424..0c6cea6b 100755
--- a/ShellB3/shallbethree.sh
+++ b/ShellB3/shallbethree.sh
@@ -15583,7 +15583,7 @@ fetch_pip_latest(){
   # use pip to fetch latest versions of currently installed modules into src/fetched
    mkdir -p src/fetched
   ( ${BASE}/bin/pip${PYFSVER} list -o | grep Current | sed s,\),,g | awk '{print $1 "==" $5}' \
-    | xargs ${BASE}/bin/pip${PYFSVER} install --no-binary :all: --download ${REALBASE}/src/fetched )
+    | xargs ${BASE}/bin/pip${PYFSVER} install --no-binary --all --download ${REALBASE}/src/fetched )
 }
 
 _list_addons(){
@@ -15695,11 +15695,15 @@ allsrc_sorted(){
 }
 
 allpythonsrc(){
-  allsrc_sorted | xargs -I {} -n 1 bash -c '_echoIfPythonSrcPackage "$@"' _ {}
+  allsrc_sorted | while read x ; do
+      _echoIfPythonSrcPackage "$x"
+    done
 }
 
 allothersrc(){
-  allsrc_sorted | xargs -I {} -n 1 bash -c '_echoIfNotPythonSrcPackage "$@"' _ {}
+  allsrc_sorted | while read x ; do
+      _echoIfNotPythonSrcPackage "$x"
+    done
 }
 
 allsrcpkgs(){
@@ -15744,13 +15748,13 @@ SPYTHON
   echo FETCHING "$@"
   if [ -e ${BASE}/bin/unearth ] ; then
     echo Using SB3 UNEARTH
-    ( unset http_proxy https_proxy ; ${BASE}/bin/unearth --no-binary :all: "$@" --all | ${PYTHON} ${TMPURL} | xargs -I {} -n 1 bash -c '_maybe_download "$@"' _ {} )
+    ( unset http_proxy https_proxy ; ${BASE}/bin/unearth --no-binary "$@" --all | ${PYTHON} ${TMPURL} | while read x ; do _maybe_download "$x" ; done )
   elif [ -e ~/bin/unearth ] ; then
     echo USING System UNEARTH
-    ( unset http_proxy https_proxy ; ~/bin/unearth --no-binary :all: "$@" --all | ${PYTHON} ${TMPURL} | xargs -I {} -n 1 bash -c '_maybe_download "$@"' _ {} )
+    ( unset http_proxy https_proxy ; ~/bin/unearth --no-binary "$@" --all | ${PYTHON} ${TMPURL} | while read x ; do _maybe_download "$x" ; done )
   else
     echo USING PIP
-    ( unset http_proxy https_proxy ; ${BASE}/bin/pip download --src `pwd`/src/autodownloaded --dest  `pwd`/src/autodownloaded --no-binary :all: "$@"  )
+    ( unset http_proxy https_proxy ; ${BASE}/bin/pip download --src `pwd`/src/autodownloaded --dest  `pwd`/src/autodownloaded --no-binary "$@"  )
   fi
 
   rm ${TMPURL}
@@ -15759,7 +15763,9 @@ export -f _fetch_pypi _maybe_download
 
 pypi_getallsrc(){
   mkdir -p src/autodownloaded 2>/dev/null
-  allsrcpkgs | xargs -I {} -n 1 bash -c '_fetch_pypi "$@"' _ {}
+  allsrcpkgs | while read x ; do
+      _fetch_pypi "$x"
+    done
 }
 
 allpkgversions(){
-- 
GitLab