ci: make failure to find perforce more user friendly

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Carlo Marcelo Arenas Belón committed May 12, 2022 at 15:39 UTC cde6b9b78d8c2c6d3436c59f91e09901026e6f8f
1 file changed +6 -2
ci/install-dependencies.sh
+6 -2
@@ -78,15 +78,19 @@ linux-gcc-default)
78 ;;
79 esac
80
81 -if type p4d >/dev/null && type p4 >/dev/null
81 +if type p4d >/dev/null 2>&1 && type p4 >/dev/null 2>&1
82 then
83 echo "$(tput setaf 6)Perforce Server Version$(tput sgr0)"
84 p4d -V | grep Rev.
85 echo "$(tput setaf 6)Perforce Client Version$(tput sgr0)"
86 p4 -V | grep Rev.
87 +else
88 + echo >&2 "WARNING: perforce wasn't installed, see above for clues why"
89 fi
88 -if type git-lfs >/dev/null
90 +if type git-lfs >/dev/null 2>&1
91 then
92 echo "$(tput setaf 6)Git-LFS Version$(tput sgr0)"
93 git-lfs version
94 +else
95 + echo >&2 "WARNING: git-lfs wasn't installed, see above for clues why"
96 fi