mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-22 08:27:06 +00: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:
parent
4647e64f13
commit
48e4eceb0a
2 changed files with 5 additions and 3 deletions
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
@ -11,5 +11,5 @@
|
||||||
"eslint.workingDirectories": ["./web"],
|
"eslint.workingDirectories": ["./web"],
|
||||||
"prettier.configPath": "./web/.prettierrc.js",
|
"prettier.configPath": "./web/.prettierrc.js",
|
||||||
"prettier.ignorePath": "./web/.prettierignore",
|
"prettier.ignorePath": "./web/.prettierignore",
|
||||||
"cSpell.words": ["Curr", "doublestar", "multierr"]
|
"cSpell.words": ["Curr", "doublestar", "ERRORLEVEL", "multierr"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,9 +31,11 @@ func genCmdByShell(shell string, cmds []string) (args []string, err error) {
|
||||||
|
|
||||||
switch strings.TrimSuffix(strings.ToLower(shell), ".exe") {
|
switch strings.TrimSuffix(strings.ToLower(shell), ".exe") {
|
||||||
case "cmd":
|
case "cmd":
|
||||||
script := ""
|
script := "@SET PROMPT=$\n"
|
||||||
for _, cmd := range cmds {
|
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")
|
cmd, err := os.CreateTemp(os.TempDir(), "*.cmd")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue