From 71b4779c962c1be16b98ea5a3ca3974443e9c89b Mon Sep 17 00:00:00 2001 From: eriknordmark Date: Tue, 24 Oct 2023 17:46:02 +0200 Subject: [PATCH] exec: avoid clobbering timeout Signed-off-by: eriknordmark (cherry picked from commit 7142b9df4b95f2d813cab1768675c2a2e4f1d2b9) --- pkg/pillar/base/execwrapper.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/pillar/base/execwrapper.go b/pkg/pillar/base/execwrapper.go index ba650ab9e6..b84a0949bd 100644 --- a/pkg/pillar/base/execwrapper.go +++ b/pkg/pillar/base/execwrapper.go @@ -48,7 +48,9 @@ func (c *Command) Output() ([]byte, error) { var buf bytes.Buffer c.command.Stdout = &buf c.buffer = &buf - c.timeout = defaultTimeout + if c.timeout == 0 { + c.timeout = defaultTimeout + } return c.execCommand() } @@ -59,7 +61,9 @@ func (c *Command) CombinedOutput() ([]byte, error) { c.command.Stdout = &buf c.command.Stderr = &buf c.buffer = &buf - c.timeout = defaultTimeout + if c.timeout == 0 { + c.timeout = defaultTimeout + } return c.execCommand() }