diff options
author | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2018-03-09 17:33:18 +0100 |
---|---|---|
committer | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2018-03-09 17:33:18 +0100 |
commit | 00b5b83dcff4904aeb18760caa193fa3393241e0 (patch) | |
tree | 447d4d5249e659de8c0a062559bb58f739220322 /cmd-sdks.go | |
parent | 04040c928142db92d2ef2d4b43ad4701392e5ceb (diff) |
Fixed terminal output (support escape and control characters)
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'cmd-sdks.go')
-rw-r--r-- | cmd-sdks.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/cmd-sdks.go b/cmd-sdks.go index 3fc596f..eeebffa 100644 --- a/cmd-sdks.go +++ b/cmd-sdks.go @@ -242,7 +242,7 @@ func sdksInstall(ctx *cli.Context) error { } exitChan := make(chan exitResult, 1) - IOsk.On("disconnection", func(err error) { + IOSkClient.On("disconnection", func(err error) { Log.Debugf("WS disconnection event with err: %v\n", err) errMsg := "" if err != nil { @@ -251,7 +251,7 @@ func sdksInstall(ctx *cli.Context) error { exitChan <- exitResult{errMsg, 2} }) - IOsk.On(xaapiv1.EVTSDKManagement, func(ev xaapiv1.EventMsg) { + IOSkClient.On(xaapiv1.EVTSDKManagement, func(ev xaapiv1.EventMsg) { sdkEvt, _ := ev.DecodeSDKMgtMsg() if sdkEvt.Action != xaapiv1.SdkMgtActionInstall { @@ -259,11 +259,11 @@ func sdksInstall(ctx *cli.Context) error { return } - if !shortOut && sdkEvt.Stdout != "" { - fmt.Printf("%s", sdkEvt.Stdout) + if !shortOut && len(sdkEvt.Stdout) > 0 { + os.Stdout.Write([]byte(sdkEvt.Stdout)) } - if !shortOut && sdkEvt.Stderr != "" { - fmt.Fprintf(os.Stderr, "%s", sdkEvt.Stderr) + if !shortOut && len(sdkEvt.Stderr) > 0 { + os.Stderr.Write([]byte(sdkEvt.Stderr)) } if sdkEvt.Exited { @@ -271,7 +271,7 @@ func sdksInstall(ctx *cli.Context) error { } }) - IOsk.On(xaapiv1.EVTSDKStateChange, func(ev xaapiv1.EventMsg) { + IOSkClient.On(xaapiv1.EVTSDKStateChange, func(ev xaapiv1.EventMsg) { sdk, _ := ev.DecodeSDKEvent() Log.Debugf("EVTSDKStateChange: %v", sdk) }) |