Client: Give up terminal until external state change.

It's now possible to run `cat` and `vim` from `das`! dasc's response handling
is currently very adhoc, though.
This commit is contained in:
Cheer Xiao 2013-06-18 21:32:04 +08:00
parent d00be693b0
commit 89517efc66

View File

@ -93,9 +93,17 @@ func main() {
req.Write(json) req.Write(json)
req.WriteString("\n") req.WriteString("\n")
msg, err := res.ReadBytes('\n') for {
if err == nil { msg, err := res.ReadString('\n')
if err != nil {
fmt.Printf("broken response pipe, quitting")
os.Exit(1)
} else {
fmt.Printf("response: %s", msg) fmt.Printf("response: %s", msg)
} }
if strings.HasPrefix(msg, "external") {
break
}
}
} }
} }