From 4d3a18362901f4d9ddbe2d1742f9e0ca3613fb0e Mon Sep 17 00:00:00 2001 From: Tsukasa OI Date: Tue, 12 Sep 2023 02:06:13 +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 6777cbf..f6a0eba 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."