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

Side by Side Diff: go/src/infra/tools/drover/util.go

Issue 662113003: Drover's back, baby! (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git/+/master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
OLDNEW
(Empty)
1 package main
2
3 import "fmt"
4 import "os"
5 import "os/exec"
6 import "strings"
7
8 func failIf(err error) {
9 if err != nil {
10 fmt.Println("fatal:", err)
11 os.Exit(1)
M-A Ruel 2014/10/18 00:47:06 That's a bit severe and hard to test.
12 }
13 }
14
15 func SplitLines(data string) []string {
16 return strings.Split(strings.TrimRight(data, "\n"), "\n")
17 }
18
19 func Shell(dir string) bool {
20 shell := os.Getenv("SHELL")
21 if shell == "" {
22 shell = DefaultShell
23 }
24 shell, err := exec.LookPath(shell)
25 failIf(err)
26 p, err := os.StartProcess(shell, []string{shell}, &os.ProcAttr{
27 Dir: dir,
28 Files: []*os.File{os.Stdin, os.Stdout, os.Stderr},
29 })
30 failIf(err)
31 s, err := p.Wait()
32 failIf(err)
33
34 return s.Success()
35 }
OLDNEW
« go/src/infra/tools/drover/main.go ('K') | « go/src/infra/tools/drover/merge.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698