Files
podman/pkg/machine/ssh_windows.go
Jason T. Greene 487219d809 Complete WSL implementation, refactor a few areas
Also addresses a number of issues:
- StopHostNetworking isn't plumbed, win-sshproxy leaks on hyperv
- Wait api and print output doesn't work properly on Windows
- API forwarding doesn't work on WSL
- Terminal corruption with after start/stop on Windows
- Gvproxy is forcefully killed vs gracefully quit
- Switching rootful/rootless does not update /var/run/docker.sock on the guest
- File already closed error on init
- HyperV backend is publishing Unix sockets when it should be named pipes
- User-mode networking doesn't always work
- Stop state outside of lock boundaries
- WSL blocks parallel machined (should be supported)

[NO NEW TESTS NEEDED]

Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2024-02-11 12:58:11 -06:00

43 lines
860 B
Go

package machine
import (
"io"
"os"
"os/exec"
"github.com/sirupsen/logrus"
)
func setupIOPassthrough(cmd *exec.Cmd, interactive bool) error {
cmd.Stdin = os.Stdin
if interactive {
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
return nil
}
// OpenSSh mucks with the associated virtual console when there is no pty,
// leaving it in a broken state. Pipe the output to isolate stdout/stderr
stdout, err := cmd.StdoutPipe()
if err != nil {
return err
}
stderr, err := cmd.StderrPipe()
if err != nil {
return err
}
copier := func(name string, dest string, from io.Reader, to io.Writer) {
if _, err := io.Copy(to, from); err != nil {
logrus.Warnf("could not copy output from command %s to %s", name, dest)
}
}
go copier(cmd.Path, "stdout", stdout, os.Stdout)
go copier(cmd.Path, "stderr", stderr, os.Stderr)
return nil
}