Support aborting with Ctrl-C

This commit is contained in:
HAYAMA_Kaoru
2024-12-01 13:09:16 +09:00
parent 5abb509017
commit 1b20e3b846
3 changed files with 43 additions and 10 deletions
+3 -1
View File
@@ -50,7 +50,9 @@ func mains(args []string) error {
}
lisp = lisp.Let(&gmnlisp.Pair{Key: gmnlisp.NewSymbol("args"), Value: gmnlisp.List(posixArgv...)})
_, err = lisp.Interpret(context.Background(), string(script))
ctx, cancel := context.WithCancel(context.Background())
_, err = lisp.Interpret(ctx, string(script))
cancel()
return err
}