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

Unified Diff: experimental/webtry/webtry.go

Issue 252863002: Add pathops and capture stderr so we can get SkDebugf output. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 8 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 | « experimental/webtry/templates/template.cpp ('k') | gyp/webtry.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/webtry/webtry.go
diff --git a/experimental/webtry/webtry.go b/experimental/webtry/webtry.go
index 8e02a751a32f6786f00cb669a837e02d01f9602a..6aa186ced857df902d0277462d543ba9bb2655e6 100644
--- a/experimental/webtry/webtry.go
+++ b/experimental/webtry/webtry.go
@@ -258,8 +258,7 @@ type response struct {
}
// doCmd executes the given command line string in either the out/Debug
-// directory or the inout directory. Returns the stdout, and stderr in the case
-// of a non-zero exit code.
+// directory or the inout directory. Returns the stdout and stderr.
func doCmd(commandLine string, moveToDebug bool) (string, error) {
log.Printf("Command: %q\n", commandLine)
programAndArgs := strings.SplitN(commandLine, " ", 2)
@@ -283,21 +282,13 @@ func doCmd(commandLine string, moveToDebug bool) (string, error) {
cmd.Dir = abs
}
log.Printf("Run in directory: %q\n", cmd.Dir)
- var stdOut bytes.Buffer
- cmd.Stdout = &stdOut
- var stdErr bytes.Buffer
- cmd.Stderr = &stdErr
- cmd.Start()
- err = cmd.Wait()
- message := stdOut.String()
- log.Printf("StdOut: %s\n", message)
+ message, err := cmd.CombinedOutput()
+ log.Printf("StdOut + StdErr: %s\n", string(message))
if err != nil {
log.Printf("Exit status: %s\n", err.Error())
- log.Printf("StdErr: %s\n", stdErr.String())
- message += stdErr.String()
- return message, fmt.Errorf("Failed to run command.")
+ return string(message), fmt.Errorf("Failed to run command.")
}
- return message, nil
+ return string(message), nil
}
// reportError formats an HTTP error response and also logs the detailed error message.
« no previous file with comments | « experimental/webtry/templates/template.cpp ('k') | gyp/webtry.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698