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 cli/internal/ansible/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"sync/atomic"
"syscall"
Expand Down Expand Up @@ -229,6 +230,16 @@ func buildArgs(opts RunOptions, cfg *config.Config) []string {
func buildEnv(opts RunOptions, cfg *config.Config) ([]string, error) {
env := os.Environ()

// On macOS, the ObjC runtime aborts forked child processes when class
// initialisation is in progress at fork time. Ansible forks workers
// heavily, which triggers:
// "+[NSNumber initialize] may have been in progress in another thread
// when fork() was called … Crashing instead."
// Setting this variable tells the runtime to skip the check.
if runtime.GOOS == "darwin" {
env = append(env, "OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES")
}

ansibleEnv, err := cfg.AnsibleEnv()
if err != nil {
return nil, fmt.Errorf("ansible env: %w", err)
Expand Down
Loading