We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 892d8be commit 8ba8f7bCopy full SHA for 8ba8f7b
executor.go
step.go
@@ -0,0 +1,34 @@
1
+// 24 september 2014
2
+
3
+package main
4
5
+import (
6
+ "fmt"
7
+ "os"
8
+ "os/exec"
9
+ "flag"
10
+ "bytes"
11
+ "strings"
12
+)
13
14
+var showall = flag.Bool("x", false, "show all commands as they run")
15
16
+// Step represents a single step in the build process.
17
+type Step struct {
18
+ Name string
19
+ Line []string
20
+ Output *bytes.Buffer
21
+ Error error
22
+}
23
24
+func (s *Step) Do() {
25
+ if *showall {
26
+ fmt.Printf("%s\n", strings.Join(s.Line, " "))
27
+ }
28
+ cmd := exec.Command(s.Line[0], s.Line[1:]...)
29
+ cmd.Env = os.Environ()
30
+ s.Output = new(bytes.Buffer)
31
+ cmd.Stdout = s.Output
32
+ cmd.Stderr = s.Output
33
+ s.Error = cmd.Run()
34
0 commit comments