beam/examples/beamsh: better debugging messages

Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
This commit is contained in:
Solomon Hykes 2014-03-25 14:10:30 -07:00
parent 5efb90b0cd
commit 9f4bcf010a

View file

@ -18,7 +18,6 @@ import (
) )
func main() { func main() {
Debugf("Initializing engine\n")
client, engine, err := beam.USocketPair() client, engine, err := beam.USocketPair()
if err != nil { if err != nil {
Fatal(err) Fatal(err)
@ -72,9 +71,9 @@ func executeScript(client *net.UnixConn, script []*dockerscript.Command) {
executeScript(job, cmd.Children) executeScript(job, cmd.Children)
// TODO: pass a default handler to deal with 'status' // TODO: pass a default handler to deal with 'status'
// --> use beam chaining? // --> use beam chaining?
Debugf("Listening for reply messages\n") Debugf("[%s] Listening for reply messages\n", strings.Join(cmd.Args, " "))
Serve(job, builtinsHandler) Serve(job, builtinsHandler)
Debugf("[%s] done\n", strings.Join(cmd.Args, " ")) Debugf("[%s] done listening for reply messages\n", strings.Join(cmd.Args, " "))
} }
} }
@ -163,13 +162,11 @@ func CmdTrace(args []string, f *os.File) {
} }
defer resp.Close() defer resp.Close()
for { for {
Logf("[trace] waiting for a message\n")
payload, attachment, err := beam.Receive(resp) payload, attachment, err := beam.Receive(resp)
if err != nil { if err != nil {
Logf("[trace] error waiting for message\n") Logf("[trace] error waiting for message\n")
return return
} }
Logf("[trace] received message!\n")
msg, err := data.Decode(string(payload)) msg, err := data.Decode(string(payload))
if err != nil { if err != nil {
fmt.Printf("===> %s\n", payload) fmt.Printf("===> %s\n", payload)