@@ -20,7 +20,9 @@ package runc
20
20
21
21
import (
22
22
"github.com/pkg/errors"
23
+ "github.com/sirupsen/logrus"
23
24
"golang.org/x/sys/unix"
25
+ "runtime"
24
26
)
25
27
26
28
// NewPipeIO creates pipe pairs to be used with runc
@@ -47,7 +49,13 @@ func NewPipeIO(uid, gid int, opts ...IOOpt) (i IO, err error) {
47
49
}
48
50
pipes = append (pipes , stdin )
49
51
if err = unix .Fchown (int (stdin .r .Fd ()), uid , gid ); err != nil {
50
- return nil , errors .Wrap (err , "failed to chown stdin" )
52
+ // TODO: revert with proper darwin solution, skipping for now
53
+ // as darwin chown is returning EINVAL on anonymous pipe
54
+ if runtime .GOOS == "darwin" {
55
+ logrus .WithError (err ).Debug ("failed to chown stdin, ignored" )
56
+ } else {
57
+ return nil , errors .Wrap (err , "failed to chown stdin" )
58
+ }
51
59
}
52
60
}
53
61
if option .OpenStdout {
@@ -56,7 +64,13 @@ func NewPipeIO(uid, gid int, opts ...IOOpt) (i IO, err error) {
56
64
}
57
65
pipes = append (pipes , stdout )
58
66
if err = unix .Fchown (int (stdout .w .Fd ()), uid , gid ); err != nil {
59
- return nil , errors .Wrap (err , "failed to chown stdout" )
67
+ // TODO: revert with proper darwin solution, skipping for now
68
+ // as darwin chown is returning EINVAL on anonymous pipe
69
+ if runtime .GOOS == "darwin" {
70
+ logrus .WithError (err ).Debug ("failed to chown stdout, ignored" )
71
+ } else {
72
+ return nil , errors .Wrap (err , "failed to chown stdout" )
73
+ }
60
74
}
61
75
}
62
76
if option .OpenStderr {
@@ -65,7 +79,13 @@ func NewPipeIO(uid, gid int, opts ...IOOpt) (i IO, err error) {
65
79
}
66
80
pipes = append (pipes , stderr )
67
81
if err = unix .Fchown (int (stderr .w .Fd ()), uid , gid ); err != nil {
68
- return nil , errors .Wrap (err , "failed to chown stderr" )
82
+ // TODO: revert with proper darwin solution, skipping for now
83
+ // as darwin chown is returning EINVAL on anonymous pipe
84
+ if runtime .GOOS == "darwin" {
85
+ logrus .WithError (err ).Debug ("failed to chown stderr, ignored" )
86
+ } else {
87
+ return nil , errors .Wrap (err , "failed to chown stderr" )
88
+ }
69
89
}
70
90
}
71
91
return & pipeIO {
0 commit comments