Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions tests/local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ is_static_analysis_version() {
return 1
}

docker() {
if type -P 'docker' >'/dev/null' 2>&1; then
command 'docker' "$@"
elif command -v 'flatpak-spawn' >'/dev/null' 2>&1 && flatpak-spawn --host 'docker' --version >'/dev/null' 2>&1; then
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Extra host spawn on every Docker call in Toolbox

In the Toolbox/flatpak path, flatpak-spawn --host docker --version is executed as a probe on every single call to the docker() function — meaning each of the many docker run invocations in the suite spawns one extra process on the host just to re-confirm that Docker is available. Since the result can't change within a script run, this probe could be moved to a one-time check at script startup (e.g., cache the detected mode in a variable), avoiding the redundant roundtrip on each invocation.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

command 'flatpak-spawn' --host 'docker' "$@"
else
echo >&2 'Docker not available.'
return 1
fi
}

docker_composer() {
mkdir -p '/tmp/composer' 2>'/dev/null' || true
docker run --rm \
Expand Down