gopkg.in/tools/godep.v35@v35.0.0-20151212003741-483cb8869554/util.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"os/exec"
     6  )
     7  
     8  // Runs a command in dir.
     9  // The name and args are as in exec.Command.
    10  // Stdout, stderr, and the environment are inherited
    11  // from the current process.
    12  func runIn(dir, name string, args ...string) error {
    13  	c := exec.Command(name, args...)
    14  	c.Dir = dir
    15  	output, err := c.CombinedOutput()
    16  
    17  	if verbose {
    18  		fmt.Printf("execute: %+v\n", c)
    19  		fmt.Printf(" output: %s\n", output)
    20  	}
    21  
    22  	return err
    23  }