Write err to stderr, exit 1 if err != ""

Closes #475
This commit is contained in:
Dan Buch
2016-07-24 11:57:51 -04:00
parent 492afb9149
commit dd253d122c
3 changed files with 69 additions and 4 deletions

View File

@@ -13,6 +13,19 @@ import (
"testing"
)
var (
lastExitCode = 0
fakeOsExiter = func(rc int) {
lastExitCode = rc
}
fakeErrWriter = &bytes.Buffer{}
)
func init() {
OsExiter = fakeOsExiter
ErrWriter = fakeErrWriter
}
type opCounts struct {
Total, BashComplete, OnUsageError, Before, CommandNotFound, Action, After, SubCommand int
}