1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-12-24 10:07:21 +02:00

local backend make cmd log output similar to other shells (#2678)

the cmd currently shows the full prompt and drop the exact error level.

this set the prompt to be hidden and let cmd exit with error level
reported by the command

---
*Sponsored by Kithara Software GmbH*
This commit is contained in:
6543 2023-11-01 11:49:36 +01:00 committed by GitHub
parent 4647e64f13
commit 48e4eceb0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -11,5 +11,5 @@
"eslint.workingDirectories": ["./web"],
"prettier.configPath": "./web/.prettierrc.js",
"prettier.ignorePath": "./web/.prettierignore",
"cSpell.words": ["Curr", "doublestar", "multierr"]
"cSpell.words": ["Curr", "doublestar", "ERRORLEVEL", "multierr"]
}

View File

@ -31,9 +31,11 @@ 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"
}
cmd, err := os.CreateTemp(os.TempDir(), "*.cmd")
if err != nil {