Fixed terminal output (support escape and control characters)
[src/xds/xds-server.git] / lib / xdsserver / sdk.go
index 374fb12..c1bf043 100644 (file)
@@ -247,6 +247,7 @@ func (s *CrossSDK) Install(file string, force bool, timeout int, args []string,
        // Create new instance to execute command and sent output over WS
        s.installCmd = eows.New(s.scripts[scriptAdd], cmdArgs, sess.IOSocket, sess.ID, cmdID)
        s.installCmd.Log = s.Log
+       // TODO: enable Term s.installCmd.PtyMode = true
        s.installCmd.LineTimeSpan = 500 * time.Millisecond.Nanoseconds()
        if timeout > 0 {
                s.installCmd.CmdExecTimeout = timeout
@@ -255,7 +256,11 @@ func (s *CrossSDK) Install(file string, force bool, timeout int, args []string,
        }
 
        // Define callback for output (stdout+stderr)
-       s.installCmd.OutputCB = func(e *eows.ExecOverWS, stdout, stderr string) {
+       s.installCmd.OutputCB = func(e *eows.ExecOverWS, bStdout, bStderr []byte) {
+
+               stdout := string(bStdout)
+               stderr := string(bStderr)
+
                // paranoia
                data := e.UserData
                sdkID := (*data)["SDKID"].(string)