From 9b728a8adeb4fcf141086688cdfa0d6c4758eef0 Mon Sep 17 00:00:00 2001 From: Pascal Muetschard Date: Thu, 13 Jun 2019 10:19:28 -0700 Subject: [PATCH] Make Android Perfetto tracing work on Windows. Passing the binary data via adb doesn't quite work on Windows, so encode the proto to base64 to make it go safely through adb. --- core/os/android/adb/perfetto.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/os/android/adb/perfetto.go b/core/os/android/adb/perfetto.go index 24a4bae0b2..6a4837b05f 100644 --- a/core/os/android/adb/perfetto.go +++ b/core/os/android/adb/perfetto.go @@ -16,8 +16,8 @@ package adb import ( "bufio" - "bytes" "context" + "encoding/base64" "io" "strings" @@ -56,8 +56,8 @@ func (b *binding) StartPerfettoTrace(ctx context.Context, config *perfetto_pb.Tr } }) - process, err := b.Shell("perfetto", "-c", "-", "-o", out). - Read(bytes.NewReader(data)). + process, err := b.Shell("base64", "-d", "|", "perfetto", "-c", "-", "-o", out). + Read(strings.NewReader(base64.StdEncoding.EncodeToString(data))). Capture(stdout, stdout). Start(ctx) if err != nil {