aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2018-01-24 00:25:10 +0100
committerDimitri Sokolyuk <demon@dim13.org>2018-01-24 00:25:10 +0100
commit07584da73461b69043451ebe48fcac226202492a (patch)
tree1f65f42f61bd10079ff369b039ff8dc0282f816d /cmd
parentbc1a7a271ba5a3f971e9dbed774b01b43af2642e (diff)
extract console, extract context
Diffstat (limited to 'cmd')
-rw-r--r--cmd/eval/main.go5
-rw-r--r--cmd/j1e/main.go5
2 files changed, 8 insertions, 2 deletions
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))
}