From 5b717c0ba42aa4de3101b98136155cd806764142 Mon Sep 17 00:00:00 2001 From: Matt Heon Date: Thu, 14 Dec 2023 15:39:48 -0500 Subject: [PATCH] Set stdin to nil for HyperV execs We're seeing a bug where failed Podman commands can hang in the test suite, but somehow un-hang on STDIN activity (e.g. pressing enter). On Brent's vague suspicion that it was related to STDIN, I disabled STDIN on all execs from HyperV, and the hangs disappear. I don't know why this is, or why the hangs happen in the first place, but since this seems to work and should not have any negative consequences that I can think of, here we go. [NO NEW TESTS NEEDED] I have no idea how to test this one. Signed-off-by: Matt Heon --- pkg/machine/e2e/config_test.go | 1 + pkg/machine/hyperv/machine.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/pkg/machine/e2e/config_test.go b/pkg/machine/e2e/config_test.go index 10efea74d5..df9d8459d8 100644 --- a/pkg/machine/e2e/config_test.go +++ b/pkg/machine/e2e/config_test.go @@ -164,6 +164,7 @@ func runWrapper(podmanBinary string, cmdArgs []string, timeout time.Duration, wa } GinkgoWriter.Println(podmanBinary + " " + strings.Join(cmdArgs, " ")) c := exec.Command(podmanBinary, cmdArgs...) + c.Stdin = nil session, err := Start(c, GinkgoWriter, GinkgoWriter) if err != nil { Fail(fmt.Sprintf("Unable to start session: %q", err)) diff --git a/pkg/machine/hyperv/machine.go b/pkg/machine/hyperv/machine.go index 272bf04ebb..625e77ab95 100644 --- a/pkg/machine/hyperv/machine.go +++ b/pkg/machine/hyperv/machine.go @@ -775,6 +775,8 @@ func (m *HyperVMachine) startHostNetworking() (string, machine.APIForwardingStat logrus.Debugf("Starting gvproxy with command: %s %v", gvproxyBinary, c.Args) + c.Stdin = nil + if err := c.Start(); err != nil { return "", 0, fmt.Errorf("unable to execute: %s: %w", cmd.ToCmdline(), err) } @@ -811,6 +813,8 @@ func (m *HyperVMachine) startHostNetworking() (string, machine.APIForwardingStat } } + fsCmd.Stdin = nil + if err := fsCmd.Start(); err != nil { return "", 0, fmt.Errorf("unable to execute: %s %v: %w", executable, args, err) }