Skip to content

Commit

Permalink
Detect Docker robustly
Browse files Browse the repository at this point in the history
"&> /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 <research_trasio@irq.a4lg.com>
  • Loading branch information
a4lg committed Sep 12, 2023
1 parent 4b8cbe8 commit 1e185e8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit 1e185e8

Please sign in to comment.