Added the write method to the Instance object so that it can be passed around as a io.Writer object.

This commit is contained in:
Kris Watts 2015-09-23 21:22:26 -06:00
parent 8fcf9da96c
commit 800fa3d2b8
2 changed files with 8 additions and 1 deletions

View File

@ -1,12 +1,13 @@
package main
import (
"fmt"
"io"
"log"
"strconv"
"time"
"github.com/chzyer/readline"
"github.com/traetox/readline"
)
func usage(w io.Writer) {
@ -43,6 +44,8 @@ func main() {
}()
case "bye":
goto exit
case "write":
fmt.Fprintf(l, "look, i am writer too\n")
case "":
default:
log.Println("you said:", strconv.Quote(line))

View File

@ -44,3 +44,7 @@ func (i *Instance) Close() error {
i.o.Close()
return i.t.Close()
}
func (i *Instance) Write(b []byte) (int, error) {
return i.o.Stderr().Write(b)
}