叉/exec/bin/sh无效参数
该问题在MAC上不稳定复制。代码片段如下:
cmd := exec.Command("/bin/zsh", "-c", `brew info goland`)
cmd.SysProcAttr = &syscall.SysProcAttr{
Credential: &syscall.Credential{
Uid: 501,
Gid: 20,
Groups: []uint32{2, 3, 4},
},
}
output, err := cmd.CombinedOutput()
if err != nil {
println(err)
}
我以root运行该过程,并与另一个用户一起执行command。它在一些Mac计算机上失败并报告“ fork/exec/bin/zsh无效参数”错误消息。 有人知道原因吗?谢谢〜
The issue is not stably reproduced on mac. the code snippet is as below:
cmd := exec.Command("/bin/zsh", "-c", `brew info goland`)
cmd.SysProcAttr = &syscall.SysProcAttr{
Credential: &syscall.Credential{
Uid: 501,
Gid: 20,
Groups: []uint32{2, 3, 4},
},
}
output, err := cmd.CombinedOutput()
if err != nil {
println(err)
}
i run the process as root, and exec command with another user. It failed on some mac computer and report "fork/exec /bin/zsh invalid argument" error message.
anybody know the cause? thanks~
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论