Message ID | 20220423142559.32507-2-carenas@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ci: avoid perforce/brew issues affecting macOS | expand |
Carlo Marcelo Arenas Belón <carenas@gmail.com> writes: > -if type p4d >/dev/null && type p4 >/dev/null > +if type p4d >/dev/null 2>&1 && type p4 >/dev/null 2>&1 > then > echo "$(tput setaf 6)Perforce Server Version$(tput sgr0)" > p4d -V | grep Rev. > echo "$(tput setaf 6)Perforce Client Version$(tput sgr0)" > p4 -V | grep Rev. > +else > + echo "WARNING: perforce wasn't installed, see above for clues why" >2 > fi > -if type git-lfs >/dev/null > +if type git-lfs >/dev/null 2>&1 > then > echo "$(tput setaf 6)Git-LFS Version$(tput sgr0)" > git-lfs version > +else > + echo "WARNING: git-lfs wasn't installed, see above for clues why" >2 > fi NO! Why do we want to create a file whose name is "2" here? Good that I caught them before I merged them to 'next'. Will locally amend and see if it fixes CI failure in 'seen' Thanks.
diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh index dbcebad2fb2..41e9290fbdd 100755 --- a/ci/install-dependencies.sh +++ b/ci/install-dependencies.sh @@ -78,15 +78,19 @@ linux-gcc-default) ;; esac -if type p4d >/dev/null && type p4 >/dev/null +if type p4d >/dev/null 2>&1 && type p4 >/dev/null 2>&1 then echo "$(tput setaf 6)Perforce Server Version$(tput sgr0)" p4d -V | grep Rev. echo "$(tput setaf 6)Perforce Client Version$(tput sgr0)" p4 -V | grep Rev. +else + echo "WARNING: perforce wasn't installed, see above for clues why" >2 fi -if type git-lfs >/dev/null +if type git-lfs >/dev/null 2>&1 then echo "$(tput setaf 6)Git-LFS Version$(tput sgr0)" git-lfs version +else + echo "WARNING: git-lfs wasn't installed, see above for clues why" >2 fi
In preparation for a future change that will make perforce installation optional in macOS, make sure that the check for it is done without triggering scary looking errors and add a user friendly message instead. All other existing uses of 'type <cmd>' in our shell scripts that check the availability of a command <cmd> send both standard output and error stream to /dev/null to squelch "<cmd> not found" diagnostic output, but this script left the standard error stream shown. Redirect it just like everybody else to squelch this error message that we fully expect to see. Helped-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com> --- ci/install-dependencies.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)