Added logging and proper execution of commands

Fixed several issues, and ran a basic test on ironsmith itself.

Need to prevent subsequent builds on same versions
This commit is contained in:
Tim Shannon
2016-04-05 21:59:52 +00:00
parent 38d20d46fe
commit 65c489c920
8 changed files with 259 additions and 59 deletions

33
exec.go Normal file
View File

@ -0,0 +1,33 @@
// Copyright 2016 Tim Shannon. All rights reserved.
// Use of this source code is governed by the MIT license
// that can be found in the LICENSE file.
package main
import (
"fmt"
"os/exec"
"strings"
)
func runCmd(cmd, dir string) ([]byte, error) {
s := strings.Fields(cmd)
var args []string
if len(s) > 1 {
args = s[1:]
}
ec := exec.Command(s[0], args...)
ec.Dir = dir
vlog("Executing command: %s in dir %s\n", cmd, dir)
result, err := ec.CombinedOutput()
if err != nil {
return nil, fmt.Errorf("%s:\n%s", err, result)
}
return result, nil
}