camput: set os.Args from env.Run.args before test's cmdmain.Main runs

Not required now, but will be for future tests.

Change-Id: I50c469d4f4fa589494036f306c25fe60914fb902
This commit is contained in:
Brad Fitzpatrick 2014-02-18 18:47:05 -08:00
parent 16219f24b0
commit 1509f266be
1 changed files with 2 additions and 0 deletions

View File

@ -19,6 +19,7 @@ package main
import (
"bytes"
"io"
"os"
"runtime"
"testing"
"time"
@ -37,6 +38,7 @@ type env struct {
func (e *env) Run(args ...string) (out, err []byte, exitCode int) {
outbuf := new(bytes.Buffer)
errbuf := new(bytes.Buffer)
os.Args = append(os.Args[:1], args...)
cmdmain.Stdout, cmdmain.Stderr = outbuf, errbuf
exitc := make(chan int, 1)
cmdmain.Exit = func(code int) {