Skip to content

Commit a34f960

Browse files
committed
Improve panic builtin
1 parent ac7dc75 commit a34f960

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

converters/bash/converter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ func (c *converter) Print(values []string) error {
209209

210210
func (c *converter) Panic(value string) error {
211211
c.addLine(fmt.Sprintf("echo \"%s\"", value))
212-
c.addLine("return -1")
212+
c.addLine("exit 1")
213213
return nil
214214
}
215215

converters/batch/converter.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ func (c *converter) ProgramEnd() error {
202202
)
203203
}
204204
c.addEndLine(":end")
205-
c.addEndLine("endlocal")
205+
c.addEndLine("endlocal & exit /B %_e%")
206206
return nil
207207
}
208208

@@ -345,7 +345,7 @@ func (c *converter) Print(values []string) error {
345345

346346
func (c *converter) Panic(value string) error {
347347
c.addLine(fmt.Sprintf("echo %s", value))
348-
// TODO: Add error value.
348+
c.addLine("set \"_e=1\"")
349349
c.addLine("goto :end")
350350
return nil
351351
}

0 commit comments

Comments
 (0)