vm: provide writer in PrintOps()

Make it more flexible and testable. Fallback to using
stdout if no writer is provided.
This commit is contained in:
Evgenii Stratonikov 2020-12-01 16:52:23 +03:00
parent 9a4183abb9
commit 2f39701d76
4 changed files with 10 additions and 6 deletions

View file

@ -429,7 +429,9 @@ func handleOps(c *ishell.Context) {
return
}
v := getVMFromContext(c)
v.PrintOps()
out := bytes.NewBuffer(nil)
v.PrintOps(out)
c.Println(out.String())
}
func changePrompt(c ishell.Actions, v *vm.VM) {