Skip to content

Commit 8ba8f7b

Browse files
committed
Renamed Executor to Step. The whole terminology is going to be reworked a bit.
1 parent 892d8be commit 8ba8f7b

File tree

2 files changed

+34
-34
lines changed

2 files changed

+34
-34
lines changed

executor.go

Lines changed: 0 additions & 34 deletions
This file was deleted.

step.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)