2017-07-11 15:58:18 +00:00
|
|
|
package hugo
|
|
|
|
|
|
|
|
import (
|
2017-07-12 14:28:35 +00:00
|
|
|
"errors"
|
2017-07-11 15:58:18 +00:00
|
|
|
"os/exec"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Run executes an external command
|
|
|
|
func Run(command string, args []string, path string) error {
|
|
|
|
cmd := exec.Command(command, args...)
|
|
|
|
cmd.Dir = path
|
2017-07-12 14:28:35 +00:00
|
|
|
out, err := cmd.CombinedOutput()
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return errors.New(string(out))
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
2017-07-11 15:58:18 +00:00
|
|
|
}
|