Run creates a new process, running Script.Name() with target and any additional arguments from the command line. It returns the result of the process.
(target string, args ...string)
| 153 | // additional arguments from the command line. It returns the result of the |
| 154 | // process. |
| 155 | func (s Script) Run(target string, args ...string) error { |
| 156 | log.Println("Running", s.Name(), "with", target) |
| 157 | |
| 158 | // the first argument is the script source location. replace it with the |
| 159 | // temporary filename. |
| 160 | args[0] = s.Name() |
| 161 | |
| 162 | cmd := exec.Command(target, args...) |
| 163 | cmd.Stdout = os.Stdout |
| 164 | cmd.Stderr = os.Stderr |
| 165 | return cmd.Run() |
| 166 | } |
| 167 | |
| 168 | // Echo prints the contents of the script to STDOUT |
| 169 | func (s Script) Echo() error { |