Skip to content

Commit 97e7493

Browse files
committed
correct macos mapfile cmd
1 parent 0f01620 commit 97e7493

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

.github/workflows/build-native-nuget.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,19 @@ jobs:
136136
137137
# ---------- 找到所有动态库 ----------
138138
NUGET_LIB_DIR="${{ github.workspace }}/nuget"
139-
# find 出来的是全路径
140-
mapfile -t LIB_PATHS < <(find "$NUGET_LIB_DIR" -type f)
139+
140+
LIB_PATHS=()
141+
142+
if command -v mapfile >/dev/null 2>&1; then
143+
# Bash ≥4(Linux runner)
144+
mapfile -t LIB_PATHS < <(find "$NUGET_LIB_DIR" -type f -print)
145+
else
146+
# Bash 3.x(macOS runner)
147+
while IFS= read -r -d '' f; do
148+
LIB_PATHS+=("$f")
149+
done < <(find "$NUGET_LIB_DIR" -type f -print0)
150+
fi
151+
141152
if [ ${#LIB_PATHS[@]} -eq 0 ]; then
142153
echo "Error: no native libs found in $NUGET_LIB_DIR"
143154
exit 1

0 commit comments

Comments
 (0)