Skip to content

fix: AfterBuild.sh portability for macOS#7

Closed
jonpepler wants to merge 1 commit into
mainfrom
telemachus/afterbuild-macos
Closed

fix: AfterBuild.sh portability for macOS#7
jonpepler wants to merge 1 commit into
mainfrom
telemachus/afterbuild-macos

Conversation

@jonpepler
Copy link
Copy Markdown
Owner

Summary

Two tiny tweaks so Telemachus/AfterBuild.sh runs successfully on macOS without breaking CI/Linux.

Issues fixed

  1. ${authHeader[@]} on an empty array fires under set -o nounset on bash 3.2 (macOS system default). Replace with ${authHeader[@]+"${authHeader[@]}"} so the empty case expands to nothing instead.

  2. cp -ra isn't portable — BSD cp doesn't accept -a in the combined short form. Replace with plain cp -R everywhere; recursive copy is all the script actually needs, and none of the targets care about preserved timestamps/perms.

No behaviour change on Linux

Both forms work identically under GNU cp and modern bash. The fix just makes the script bash-3.2 + BSD-coreutils safe so a contributor can run dotnet build end-to-end on macOS without the post-build step exploding.

Test plan

  • dotnet build -c Release succeeds on macOS, publish/api-schema.json is generated.
  • Same build succeeds on Linux/CI as before.

Two tweaks for bash 3.2 (macOS system default) + BSD coreutils:

  - `${authHeader[@]}` on an empty array fires under `set -o nounset`
    on bash 3.2. Use the `${arr[@]+"${arr[@]}"}` guard so the empty
    case expands to nothing instead.
  - `cp -ra` isn't portable: BSD `cp` doesn't accept `-a` in the
    combined short form. Replace with plain `cp -R` everywhere
    (recursive copy is all the script actually needs — none of the
    targets care about preserved timestamps or permissions).

No behaviour change on Linux/CI. Lets contributors run a local
`dotnet build` end-to-end on macOS without the post-build step
exploding.
@jonpepler
Copy link
Copy Markdown
Owner Author

Superseded by upstream PR TeaGuild#87

@jonpepler jonpepler closed this May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant