Skip to content

Commit d72875d

Browse files
markshustclaude
andauthored
fix: make bin/log compatible with Bash 3.2 on macOS (closes #1440) (#1442)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent ec7b6c9 commit d72875d

1 file changed

Lines changed: 10 additions & 15 deletions

File tree

compose/bin/log

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,6 @@ Options:
1616
-h, --help Display help message"
1717
}
1818

19-
generate_logs_file_path() {
20-
local container_log_path="$1"
21-
shift # This shifts the positional parameters to the left, so $2 becomes $1, $3 becomes $2, etc.
22-
local log_files=("$@")
23-
local log_file_paths=()
24-
25-
for file in "${log_files[@]}"; do
26-
log_file_paths+=("$container_log_path$file")
27-
done
28-
29-
echo "${log_file_paths[@]}"
30-
}
31-
3219
get_all_logs_file_path() {
3320
local logs_location="$1"
3421

@@ -38,9 +25,17 @@ get_all_logs_file_path() {
3825
if [[ $1 == "-h" || $1 == "--help" ]]; then
3926
display_help
4027
elif [[ -z $1 ]]; then
41-
mapfile -t all_logs_file_path < <(get_all_logs_file_path "$CONTAINER_LOG_PATH")
28+
all_logs_file_path=()
29+
while IFS= read -r line; do
30+
all_logs_file_path+=("$line")
31+
done < <(get_all_logs_file_path "$CONTAINER_LOG_PATH")
32+
4233
bin/docker-compose exec phpfpm tail -f "${all_logs_file_path[@]}"
4334
else
44-
mapfile -t logs_file_path < <(generate_logs_file_path "$CONTAINER_LOG_PATH" "$@")
35+
logs_file_path=()
36+
for file in "$@"; do
37+
logs_file_path+=("${CONTAINER_LOG_PATH}${file}")
38+
done
39+
4540
bin/docker-compose exec phpfpm tail -f "${logs_file_path[@]}"
4641
fi

0 commit comments

Comments
 (0)