From 07584da73461b69043451ebe48fcac226202492a Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Wed, 24 Jan 2018 00:25:10 +0100 Subject: extract console, extract context --- cmd/eval/main.go | 5 ++++- cmd/j1e/main.go | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'cmd') diff --git a/cmd/eval/main.go b/cmd/eval/main.go index a5fa686..152824c 100644 --- a/cmd/eval/main.go +++ b/cmd/eval/main.go @@ -4,6 +4,7 @@ import ( "context" "dim13.org/j1" + "dim13.org/j1/console" ) func main() { @@ -11,5 +12,7 @@ func main() { if err := vm.LoadFile("testdata/j1e.bin"); err != nil { panic(err) } - vm.Run(context.Background()) + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + vm.Run(ctx, cancel, console.New(ctx)) } diff --git a/cmd/j1e/main.go b/cmd/j1e/main.go index 057e106..8f31aeb 100644 --- a/cmd/j1e/main.go +++ b/cmd/j1e/main.go @@ -6,10 +6,13 @@ import ( "context" "dim13.org/j1" + "dim13.org/j1/console" ) func main() { vm := j1.New() vm.LoadBytes(J1eBin) - vm.Run(context.Background()) + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + vm.Run(ctx, cancel, console.New(ctx)) } -- cgit v1.2.3