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

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: more tests and refactors Created 6 years, 1 month 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
« no previous file with comments | « go/src/infra/tools/drover/merge.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 package main
5
6 import (
7 "fmt"
8 "os"
9 "os/exec"
10 "strings"
11 )
12
13 func failIf(err error) {
14 if err != nil {
15 fmt.Println("fatal:", err)
16 os.Exit(1)
17 }
18 }
19
20 func SplitLines(data string) []string {
21 return strings.Split(strings.TrimRight(data, "\n"), "\n")
22 }
23
24 func Shell(dir string) bool {
25 shell := os.Getenv("SHELL")
26 if shell == "" {
27 shell = DefaultShell
28 }
29 shell, err := exec.LookPath(shell)
30 failIf(err)
31 p, err := os.StartProcess(shell, []string{shell}, &os.ProcAttr{
32 Dir: dir,
33 Files: []*os.File{os.Stdin, os.Stdout, os.Stderr},
34 })
35 failIf(err)
36 s, err := p.Wait()
37 failIf(err)
38
39 return s.Success()
40 }
OLDNEW
« no previous file with comments | « 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