Skip to content

Commit 743f645

Browse files
committed
local backend: make cmd log output similar to other shells
1 parent bd46c01 commit 743f645

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.vscode/settings.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,10 @@
1111
"eslint.workingDirectories": ["./web"],
1212
"prettier.configPath": "./web/.prettierrc.js",
1313
"prettier.ignorePath": "./web/.prettierignore",
14-
"cSpell.words": ["Curr", "doublestar", "multierr"]
14+
"cSpell.words": [
15+
"Curr",
16+
"doublestar",
17+
"ERRORLEVEL",
18+
"multierr"
19+
]
1520
}

pipeline/backend/local/command.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@ func genCmdByShell(shell string, cmds []string) (args []string, err error) {
3131

3232
switch strings.TrimSuffix(strings.ToLower(shell), ".exe") {
3333
case "cmd":
34-
script := ""
34+
script := "@SET PROMPT=$\n"
3535
for _, cmd := range cmds {
36-
script += fmt.Sprintf("%s || exit 1\n", cmd)
36+
script += fmt.Sprintf("@echo %s\n", strings.TrimSpace(shellescape.Quote("+ "+cmd)))
37+
script += fmt.Sprintf("@%s\n", cmd)
38+
script += "@IF NOT %ERRORLEVEL% == 0 exit %ERRORLEVEL%\n"
3739
}
40+
// TODO: set temp dir
3841
cmd, err := os.CreateTemp(os.TempDir(), "*.cmd")
3942
if err != nil {
4043
return nil, err

0 commit comments

Comments
 (0)