Catch empty code after engine init

This commit is contained in:
lash
2023-04-16 08:51:16 +01:00
parent a4ec4dd60e
commit 8258b9a5d8
10 changed files with 68 additions and 25 deletions

View File

@@ -22,10 +22,14 @@ func main() {
fmt.Fprintf(os.Stderr, "starting session at symbol '%s' using resource dir: %s\n", root, dir)
ctx := context.Background()
en := engine.NewSizedEngine(dir, uint32(size))
err := engine.Loop(&en, os.Stdin, os.Stdout, ctx)
en, err := engine.NewSizedEngine(dir, uint32(size))
if err != nil {
fmt.Fprintf(os.Stderr, "loop exited with error: %v", err)
fmt.Fprintf(os.Stderr, "engine create fail: %v\n", err)
os.Exit(1)
}
err = engine.Loop(&en, os.Stdin, os.Stdout, ctx)
if err != nil {
fmt.Fprintf(os.Stderr, "loop exited with error: %v\n", err)
os.Exit(1)
}
}