Skip to content

Commit

Permalink
Remove dir from proc utils
Browse files Browse the repository at this point in the history
  • Loading branch information
zachhuff386 committed Jan 3, 2017
1 parent e43757f commit 1bf2afd
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions service/utils/proc.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@ import (
"os/exec"
)

func Exec(dir, name string, arg ...string) (err error) {
func Exec(name string, arg ...string) (err error) {
cmd := exec.Command(name, arg...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr

if dir != "" {
cmd.Dir = dir
}

err = cmd.Run()
if err != nil {
err = &errortypes.ExecError{
Expand All @@ -28,7 +24,7 @@ func Exec(dir, name string, arg ...string) (err error) {
return
}

func ExecInput(dir, input, name string, arg ...string) (err error) {
func ExecInput(input, name string, arg ...string) (err error) {
cmd := exec.Command(name, arg...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
Expand All @@ -42,10 +38,6 @@ func ExecInput(dir, input, name string, arg ...string) (err error) {
}
defer stdin.Close()

if dir != "" {
cmd.Dir = dir
}

err = cmd.Start()
if err != nil {
err = &errortypes.ExecError{
Expand Down Expand Up @@ -74,14 +66,10 @@ func ExecInput(dir, input, name string, arg ...string) (err error) {
return
}

func ExecOutput(dir, name string, arg ...string) (output string, err error) {
func ExecOutput(name string, arg ...string) (output string, err error) {
cmd := exec.Command(name, arg...)
cmd.Stderr = os.Stderr

if dir != "" {
cmd.Dir = dir
}

outputByt, err := cmd.Output()
if err != nil {
err = &errortypes.ExecError{
Expand Down

0 comments on commit 1bf2afd

Please sign in to comment.