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

Unified Diff: go/util/command.go

Issue 1300273002: Reland of Add a library for running external commands, providing timeouts and test injection. (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Fix squashWriters for struct arguments. Created 5 years, 4 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 | « go/exec/exec_test.go ('k') | go/util/util.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: go/util/command.go
diff --git a/go/util/command.go b/go/util/command.go
deleted file mode 100644
index f1494ad1d891b28b85d970851c1599102f553426..0000000000000000000000000000000000000000
--- a/go/util/command.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package util
-
-import (
- "os/exec"
- "strings"
-
- "github.com/skia-dev/glog"
-)
-
-// DoCmd executes the given command line string; the command being
-// run is expected to not care what its current working directory is.
-// Returns the stdout and stderr. If there is an error, the
-// returned error will be of type ExitError, which the caller
-// can use to find out more about what happened.
-func DoCmd(commandLine string) (string, error) {
- glog.Infof("Command: %q\n", commandLine)
- programAndArgs := strings.SplitN(commandLine, " ", 2)
- program := programAndArgs[0]
- args := []string{}
- if len(programAndArgs) > 1 {
- args = strings.Split(programAndArgs[1], " ")
- }
- cmd := exec.Command(program, args...)
- message, err := cmd.CombinedOutput()
- glog.Infof("StdOut + StdErr: %s\n", string(message))
- if err != nil {
- glog.Errorf("Exit status: %s\n", err)
- return string(message), err
- }
- return string(message), nil
-}
« no previous file with comments | « go/exec/exec_test.go ('k') | go/util/util.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698