git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] p7519: improve check for prerequisite WATCHMAN

From
René Scharfe <l.s.r@web.de>
Date
Dec 16, 2017, 12:12 UTC
Message-ID
<fb8f1b3b-3668-db21-993c-087aee279936@web.de>

The return code of command -v with a non-existing command is 1 in bash and 127 in dash. Use that return code directly to allow the script to work with dash and without watchman (e.g. on Debian).

While at it stop redirecting the output. stderr is redirected to /dev/null by test_lazy_prereq already, and stdout can actually be useful -- the path of the found watchman executable is sent there, but it's shown only if the script was run with --verbose.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
 t/perf/p7519-fsmonitor.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/t/perf/p7519-fsmonitor.sh b/t/perf/p7519-fsmonitor.sh
index 16d1bf72e5..65e145c02d 100755
--- a/t/perf/p7519-fsmonitor.sh
+++ b/t/perf/p7519-fsmonitor.sh
@@ -40,8 +40,7 @@ test_lazy_prereq UNTRACKED_CACHE '
 '
 
 test_lazy_prereq WATCHMAN '
-	{ command -v watchman >/dev/null 2>&1; ret=$?; } &&
-	test $ret -ne 1
+	command -v watchman
 '
 
 if test_have_prereq WATCHMAN
-- 
2.15.1
Next: Ben Peart
Message 1 of 2 in “p7519: improve check for prerequisite WATCHMAN”
  1. p7519: improve check for prerequisite WATCHMANRené Scharfe, Dec 16, 2017
  2. Ben PeartDec 18, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.