Browse Source

Merge pull request #1 from tendermint/develop

Include pwd dir to StartProcess
pull/1842/head
Ethan Buchman 8 years ago
committed by GitHub
parent
commit
b27edfd189
2 changed files with 4 additions and 3 deletions
  1. +2
    -1
      process.go
  2. +2
    -2
      util.go

+ 2
- 1
process.go View File

@ -24,8 +24,9 @@ type Process struct {
// execPath: command name // execPath: command name
// args: args to command. (should not include name) // args: args to command. (should not include name)
func StartProcess(label string, execPath string, args []string, inFile io.Reader, outFile io.WriteCloser) (*Process, error) {
func StartProcess(label string, dir string, execPath string, args []string, inFile io.Reader, outFile io.WriteCloser) (*Process, error) {
cmd := exec.Command(execPath, args...) cmd := exec.Command(execPath, args...)
cmd.Dir = dir
cmd.Stdout = outFile cmd.Stdout = outFile
cmd.Stderr = outFile cmd.Stderr = outFile
cmd.Stdin = inFile cmd.Stdin = inFile


+ 2
- 2
util.go View File

@ -5,9 +5,9 @@ import (
) )
// Runs a command and gets the result. // Runs a command and gets the result.
func Run(command string, args []string) (string, bool, error) {
func Run(dir string, command string, args []string) (string, bool, error) {
outFile := NewBufferCloser(nil) outFile := NewBufferCloser(nil)
proc, err := StartProcess("", command, args, nil, outFile)
proc, err := StartProcess("", dir, command, args, nil, outFile)
if err != nil { if err != nil {
return "", false, err return "", false, err
} }


Loading…
Cancel
Save