Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Detect Docker robustly #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

a4lg
Copy link

@a4lg a4lg commented Sep 12, 2023

&> /dev/null works as a redirection from stdout and 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 (uses >/dev/null 2>&1 instead, makes it possible to detect "no Docker" condition correctly).

This is a port of now merged riscv/docs-spec-template#14.

"&> /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 <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant