mirror of
https://github.com/containers/podman.git
synced 2025-05-17 15:18:43 +08:00
Improved Windows compatibility
Signed-off-by: Arthur Sengileyev <arthur.sengileyev@gmail.com>
This commit is contained in:
@ -225,7 +225,7 @@ outer:
|
||||
|
||||
// https://github.com/containers/podman/issues/11248
|
||||
// Copy /dev/null to stdout and stderr to prevent SIGPIPE errors
|
||||
if f, err := os.OpenFile("/dev/null", os.O_WRONLY, 0755); err == nil {
|
||||
if f, err := os.OpenFile(os.DevNull, os.O_WRONLY, 0755); err == nil {
|
||||
unix.Dup2(int(f.Fd()), 1) //nolint:errcheck
|
||||
unix.Dup2(int(f.Fd()), 2) //nolint:errcheck
|
||||
f.Close()
|
||||
|
@ -213,8 +213,8 @@ func decompressXZ(src string, output io.WriteCloser) error {
|
||||
var read io.Reader
|
||||
var cmd *exec.Cmd
|
||||
// Prefer xz utils for fastest performance, fallback to go xi2 impl
|
||||
if _, err := exec.LookPath("xzcat"); err == nil {
|
||||
cmd = exec.Command("xzcat", "-k", src)
|
||||
if _, err := exec.LookPath("xz"); err == nil {
|
||||
cmd = exec.Command("xz", "-d", "-c", "-k", src)
|
||||
read, err = cmd.StdoutPipe()
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -545,12 +545,12 @@ func (v *MachineVM) Start(name string, _ machine.StartOptions) error {
|
||||
return err
|
||||
}
|
||||
defer fd.Close()
|
||||
dnr, err := os.OpenFile("/dev/null", os.O_RDONLY, 0755)
|
||||
dnr, err := os.OpenFile(os.DevNull, os.O_RDONLY, 0755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer dnr.Close()
|
||||
dnw, err := os.OpenFile("/dev/null", os.O_WRONLY, 0755)
|
||||
dnw, err := os.OpenFile(os.DevNull, os.O_WRONLY, 0755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -1216,11 +1216,11 @@ func (v *MachineVM) startHostNetworking() (string, apiForwardingState, error) {
|
||||
}
|
||||
|
||||
attr := new(os.ProcAttr)
|
||||
dnr, err := os.OpenFile("/dev/null", os.O_RDONLY, 0755)
|
||||
dnr, err := os.OpenFile(os.DevNull, os.O_RDONLY, 0755)
|
||||
if err != nil {
|
||||
return "", noForwarding, err
|
||||
}
|
||||
dnw, err := os.OpenFile("/dev/null", os.O_WRONLY, 0755)
|
||||
dnw, err := os.OpenFile(os.DevNull, os.O_WRONLY, 0755)
|
||||
if err != nil {
|
||||
return "", noForwarding, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user