From 7ef1f8e0803fff207f29fe40cd4a8f1ad03d4828 Mon Sep 17 00:00:00 2001 From: Tsukasa OI Date: Tue, 12 Sep 2023 02:17:34 +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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ad48dfe..2e220f1 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 \ @@ -62,4 +62,4 @@ build-no-container: clean: @echo "Cleaning up generated files..." rm -f $(PDF_RESULT) - @echo "Cleanup completed." \ No newline at end of file + @echo "Cleanup completed."