From 6b8a9f635d79797c5b908fcfb9a6f630f1eafa92 Mon Sep 17 00:00:00 2001 From: "m.huber" Date: Tue, 31 Oct 2023 15:04:20 +0100 Subject: [PATCH 1/4] local backend: make cmd log output similar to other shells --- .vscode/settings.json | 7 ++++++- pipeline/backend/local/command.go | 7 +++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index c9b36b48b1..06c5e2c17c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -11,5 +11,10 @@ "eslint.workingDirectories": ["./web"], "prettier.configPath": "./web/.prettierrc.js", "prettier.ignorePath": "./web/.prettierignore", - "cSpell.words": ["Curr", "doublestar", "multierr"] + "cSpell.words": [ + "Curr", + "doublestar", + "ERRORLEVEL", + "multierr" + ] } diff --git a/pipeline/backend/local/command.go b/pipeline/backend/local/command.go index e2b2a7eba1..390f88bef6 100644 --- a/pipeline/backend/local/command.go +++ b/pipeline/backend/local/command.go @@ -31,10 +31,13 @@ func genCmdByShell(shell string, cmds []string) (args []string, err error) { switch strings.TrimSuffix(strings.ToLower(shell), ".exe") { case "cmd": - script := "" + script := "@SET PROMPT=$\n" for _, cmd := range cmds { - script += fmt.Sprintf("%s || exit 1\n", cmd) + script += fmt.Sprintf("@echo %s\n", strings.TrimSpace(shellescape.Quote("+ "+cmd))) + script += fmt.Sprintf("@%s\n", cmd) + script += "@IF NOT %ERRORLEVEL% == 0 exit %ERRORLEVEL%\n" } + // TODO: set temp dir cmd, err := os.CreateTemp(os.TempDir(), "*.cmd") if err != nil { return nil, err From d43e3074626642518c965d7123ea6d28b15188f9 Mon Sep 17 00:00:00 2001 From: "m.huber" Date: Tue, 31 Oct 2023 15:55:05 +0100 Subject: [PATCH 2/4] prettier --- .vscode/settings.json | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 06c5e2c17c..40853bbdb7 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -11,10 +11,5 @@ "eslint.workingDirectories": ["./web"], "prettier.configPath": "./web/.prettierrc.js", "prettier.ignorePath": "./web/.prettierignore", - "cSpell.words": [ - "Curr", - "doublestar", - "ERRORLEVEL", - "multierr" - ] + "cSpell.words": ["Curr", "doublestar", "ERRORLEVEL", "multierr"] } From 099febafacfd9179677db1a19288a109dcadef91 Mon Sep 17 00:00:00 2001 From: "m.huber" Date: Tue, 31 Oct 2023 16:01:02 +0100 Subject: [PATCH 3/4] prettier log ;) --- pipeline/backend/local/command.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline/backend/local/command.go b/pipeline/backend/local/command.go index 390f88bef6..58d0a04d5a 100644 --- a/pipeline/backend/local/command.go +++ b/pipeline/backend/local/command.go @@ -33,7 +33,7 @@ func genCmdByShell(shell string, cmds []string) (args []string, err error) { case "cmd": script := "@SET PROMPT=$\n" for _, cmd := range cmds { - script += fmt.Sprintf("@echo %s\n", strings.TrimSpace(shellescape.Quote("+ "+cmd))) + script += fmt.Sprintf("@echo + %s\n", strings.TrimSpace(shellescape.Quote(cmd))) script += fmt.Sprintf("@%s\n", cmd) script += "@IF NOT %ERRORLEVEL% == 0 exit %ERRORLEVEL%\n" } From 28930787cc93eb139769c66e2ec57414a3e82f40 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Tue, 31 Oct 2023 19:15:19 +0100 Subject: [PATCH 4/4] Update pipeline/backend/local/command.go --- pipeline/backend/local/command.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pipeline/backend/local/command.go b/pipeline/backend/local/command.go index 58d0a04d5a..cfa36ad54f 100644 --- a/pipeline/backend/local/command.go +++ b/pipeline/backend/local/command.go @@ -37,7 +37,6 @@ func genCmdByShell(shell string, cmds []string) (args []string, err error) { script += fmt.Sprintf("@%s\n", cmd) script += "@IF NOT %ERRORLEVEL% == 0 exit %ERRORLEVEL%\n" } - // TODO: set temp dir cmd, err := os.CreateTemp(os.TempDir(), "*.cmd") if err != nil { return nil, err