From d7d4600feda7aeba54da9f70368af3456c842199 Mon Sep 17 00:00:00 2001 From: lilyLuLiu Date: Mon, 24 Jun 2024 14:57:05 +0800 Subject: [PATCH] [QE] fix can't catch error after execute shell cmd, https://github.com/crc-org/crc/issues/4101 --- test/extended/util/shell.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/extended/util/shell.go b/test/extended/util/shell.go index a090d4761e..c73c223083 100644 --- a/test/extended/util/shell.go +++ b/test/extended/util/shell.go @@ -229,6 +229,12 @@ func ExecuteCommand(command string) error { exitCode := <-shell.exitCodeChannel shell.excbuf.WriteString(exitCode) + if exitCode != "0" { + stderr := GetLastCommandOutput("stderr") + fmt.Println(stderr) + return errors.New(stderr) + } + return err }