Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: client/cmd/isolate/exp_archive.go

Issue 2985873002: Pass a Writer to Finalize for JSON dumping. (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | client/cmd/isolate/upload_tracker.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/cmd/isolate/exp_archive.go
diff --git a/client/cmd/isolate/exp_archive.go b/client/cmd/isolate/exp_archive.go
index d20854b036a8da611a12b4f34d8719047320ee94..a6650655e3231d62fa7f35c7800aebe37515239b 100644
--- a/client/cmd/isolate/exp_archive.go
+++ b/client/cmd/isolate/exp_archive.go
@@ -17,6 +17,8 @@ package main
import (
"errors"
"fmt"
+ "io"
+ "io/ioutil"
"log"
"os"
"path/filepath"
@@ -214,7 +216,18 @@ func (c *expArchiveRun) main() error {
return err
}
- isolDigest, err := tracker.Finalize(archiveOpts.Isolated, c.dumpJSON)
+ var dumpJSONWriter io.Writer = ioutil.Discard
+
+ if c.dumpJSON != "" {
+ f, err := os.OpenFile(c.dumpJSON, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
+ if err != nil {
+ return err
+ }
+ defer f.Close()
+ dumpJSONWriter = f
+ }
+
+ isolDigest, err := tracker.Finalize(archiveOpts.Isolated, dumpJSONWriter)
if err != nil {
return err
}
« no previous file with comments | « no previous file | client/cmd/isolate/upload_tracker.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698