Skip to content

Commit

Permalink
bash/ci: attempt fix for arm failures
Browse files Browse the repository at this point in the history
  • Loading branch information
balupton committed Jan 17, 2025
1 parent 7290028 commit b0a293a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion commands/is-accessible.bash
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ while [[ $# -ne 0 ]]; do
# stat: cannot statx '/home/runner/.cache/dorothy/5350/dir/subfile': Permission denied
# MACOS
# stat: /Users/balupton/.cache/dorothy/12776/dir/subfile: stat: Permission denied
if stat -L "$path" 2>&1 >/dev/null | grep --quiet --regexp=': Permission denied$'; then
if stat -L "$path" 2>&1 | grep --quiet --regexp=': Permission denied$'; then
exit 13 # EACCES 13 Permission denied
fi
done
18 changes: 18 additions & 0 deletions sources/bash.bash
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,24 @@ function __mkdirp {
done
if [[ ${#missing[@]} -ne 0 ]]; then
mkdir -p "${missing[@]}" || status=$?
if [[ $status -ne 0 ]]; then
local sudo_missing=()
status=0
for dir in "${missing[@]}"; do
if [[ ! -d $dir ]]; then
sudo_missing+=("$dir")
# for some reason, this detection doesn't work:
# if mkdir -p "$dir" 2>&1 | grep --quiet --regexp=': Permission denied$'; then
# sudo_missing+=("$dir")
# else
# mkdir -p "$dir" || return
# fi
fi
done
if [[ ${#sudo_missing[@]} -ne 0 ]]; then
__sudo_mkdirp -- "${sudo_missing[@]}" || status=$?
fi
fi
fi
return "$status"
}
Expand Down

0 comments on commit b0a293a

Please sign in to comment.