From 22e86a7762ff9a2b1a1131f045d097062ab04826 Mon Sep 17 00:00:00 2001 From: Tsukasa OI Date: Tue, 12 Sep 2023 02:09:48 +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 5c99a76..96347a7 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."