Skip to content

Commit

Permalink
Don't merge stdout/stderr on remote device-info.
Browse files Browse the repository at this point in the history
If the remote device-info produces stderr output, but does not
fail, we should log it, but not try to parse it as json.
  • Loading branch information
AWoloszyn committed Jul 30, 2018
1 parent 751cc96 commit e769eb8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion core/os/device/remotessh/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (

"github.com/golang/protobuf/jsonpb"
"github.com/google/gapid/core/app/layout"
"github.com/google/gapid/core/log"
"github.com/google/gapid/core/os/device"
"github.com/google/gapid/core/os/device/bind"
"github.com/google/gapid/core/os/shell"
Expand Down Expand Up @@ -196,12 +197,20 @@ func GetConnectedDevice(ctx context.Context, c Configuration) (Device, error) {
return nil, err
}

devInfo, err := b.Shell("./device-info").In(dir).Call(ctx)
stderr := bytes.Buffer{}
stdout := bytes.Buffer{}

err = b.Shell("./device-info").In(dir).Capture(&stdout, &stderr).Run(ctx)

if err != nil {
return nil, err
}

if stderr.String() != "" {
log.W(ctx, "Deviceinfo succeeded, but returned error string %s", stderr.String())
}
devInfo := stdout.String()

var device device.Instance

if err := jsonpb.Unmarshal(bytes.NewReader([]byte(devInfo)), &device); err != nil {
Expand Down

0 comments on commit e769eb8

Please sign in to comment.