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 {