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

Detect Docker robustly #26

Merged
merged 1 commit into from
Oct 8, 2023
Merged

Conversation

a4lg
Copy link
Contributor

@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 <research_trasio@irq.a4lg.com>
@ved-rivos ved-rivos merged commit 5d785d3 into riscvarchive:main Oct 8, 2023
1 check passed
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.

2 participants