From 26fbafb26837e3e22ca4d7dbafdcc1408f668be7 Mon Sep 17 00:00:00 2001 From: Tsukasa OI Date: Fri, 8 Sep 2023 06:41:29 +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."