diff --git a/go-archive/tarfs/shell_out.go b/go-archive/tarfs/shell_out.go index 5fc9201bf6..7ba0dfa227 100644 --- a/go-archive/tarfs/shell_out.go +++ b/go-archive/tarfs/shell_out.go @@ -8,6 +8,7 @@ import ( "io" "os" "os/exec" + "runtime" "strings" "syscall" ) @@ -38,7 +39,11 @@ func tarExtract(tarPath string, src io.Reader, dest string) error { func tarCompress(tarPath string, dest io.Writer, workDir string, paths ...string) error { out := new(bytes.Buffer) - tarCmd := exec.Command(tarPath, "-cf", "-", "--null", "-T", "-") + args := []string{"-cf", "-", "--null", "-T", "-"} + if runtime.GOOS == "darwin" { + args = append([]string{"--no-mac-metadata"}, args...) + } + tarCmd := exec.Command(tarPath, args...) tarCmd.Dir = workDir tarCmd.Stderr = out tarCmd.Stdout = dest diff --git a/go-archive/tgzfs/shell_out.go b/go-archive/tgzfs/shell_out.go index fcb4dc501f..8776a57097 100644 --- a/go-archive/tgzfs/shell_out.go +++ b/go-archive/tgzfs/shell_out.go @@ -8,6 +8,7 @@ import ( "io" "os" "os/exec" + "runtime" "strings" "syscall" ) @@ -38,7 +39,11 @@ func tarExtract(tarPath string, src io.Reader, dest string) error { func tarCompress(tarPath string, dest io.Writer, workDir string, paths ...string) error { out := new(bytes.Buffer) - tarCmd := exec.Command(tarPath, "-czf", "-", "--null", "-T", "-") + args := []string{"-czf", "-", "--null", "-T", "-"} + if runtime.GOOS == "darwin" { + args = append([]string{"--no-mac-metadata"}, args...) + } + tarCmd := exec.Command(tarPath, args...) tarCmd.Dir = workDir tarCmd.Stderr = out tarCmd.Stdout = dest