From b7754d6db131561b41ef859e3ef2f0bac722cb9d Mon Sep 17 00:00:00 2001 From: lonely-generation Date: Tue, 11 Jan 2022 19:13:13 +0200 Subject: [PATCH] fix GOSH execution result handling --- biz/impl/shellfunc.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/biz/impl/shellfunc.go b/biz/impl/shellfunc.go index bcdd333..6cb7172 100644 --- a/biz/impl/shellfunc.go +++ b/biz/impl/shellfunc.go @@ -45,7 +45,6 @@ func runCmd(f *ShellFuncAction, cmd string, idx1 int) { ) u.Pfv("%s\n", color.HiGreenString("%s", result.Output)) - default: defaultTimeout, _ := strconv.Atoi(ConfigRuntime().Timeout) timeout := func() time.Duration { @@ -112,10 +111,15 @@ func runCmd(f *ShellFuncAction, cmd string, idx1 int) { result.Code = 0 } - result.Output = strings.TrimSpace(outputResult) - f.Result = result + result.Output = outputResult } } + f.Result = u.ExecResult{ + ErrMsg: strings.TrimSpace(result.ErrMsg), + Output: strings.TrimSpace(result.Output), + Cmd: result.Cmd, + Code: result.Code, + } } func asyncStdReader(readtype string, ch io.ReadCloser, err error, colorfunc func(format string, a ...interface{}) string, idx1 int) string {