Skip to content

Commit

Permalink
feat: VM implements io.Reader and io.Writer
Browse files Browse the repository at this point in the history
  • Loading branch information
moisespsena committed Sep 28, 2023
1 parent d9369da commit 0c2ac27
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions vm_io.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package gad

func (vm *VM) Write(b []byte) (int, error) {
if l := len(vm.writers); l > 0 {
return vm.writers[l-1].Write(b)
}
return vm.StdOut.Write(b)
}

func (vm *VM) Read(b []byte) (int, error) {
return vm.StdIn.Read(b)
}

0 comments on commit 0c2ac27

Please sign in to comment.