From 7991f2b0ed04d1d1f5429d1074416e773dde0379 Mon Sep 17 00:00:00 2001 From: Tsukasa OI Date: Tue, 12 Sep 2023 02:22:33 +0000 Subject: [PATCH] Detect Docker robustly "&> /dev/null" works as a redirection from stdout/stderr to /dev/null in Bash but not in POSIX shell (considered as an asynchronous execution and the result of the "command" command cannot be retrieved). As a result, it always assumes that Docker always exists. This commit makes the redirection robust and portable (makes it possible to detect "no Docker" condition correctly). Signed-off-by: Tsukasa OI --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f3f67b6..32c0bdb 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ all: build build: @echo "Checking if Docker is available..." - @if command -v docker &> /dev/null ; then \ + @if command -v docker >/dev/null 2>&1 ; then \ echo "Docker is available, building inside Docker container..."; \ $(MAKE) build-container; \ else \