Wait for command to exit before testing the exit status o.o
This commit is contained in:
parent
86d77a0cee
commit
f2c80f1a2d
2 changed files with 6 additions and 7 deletions
|
@ -41,6 +41,6 @@ func (command *Command) NewScanner() *bufio.Scanner {
|
|||
return bufio.NewScanner(merged)
|
||||
}
|
||||
|
||||
func (command *Command) ExitCode() int {
|
||||
return command.cmd.ProcessState.ExitCode()
|
||||
func (command *Command) RanSuccessful() bool {
|
||||
return command.cmd.ProcessState.ExitCode() == 0
|
||||
}
|
||||
|
|
|
@ -30,12 +30,11 @@ func TestCommandOutput(t *testing.T) {
|
|||
t.Logf("Found correct output of %v", text)
|
||||
}
|
||||
}
|
||||
t.Logf("COMMAND %v", command.cmd.ProcessState.ExitCode())
|
||||
|
||||
// TODO: Find out why this is always -1
|
||||
// if command.ExitCode() != 0 {
|
||||
// t.Error("Didn't run successfully", command.ExitCode())
|
||||
// }
|
||||
command.Wait()
|
||||
if ! command.RanSuccessful() {
|
||||
t.Error("Didn't run successfully: ")
|
||||
}
|
||||
}
|
||||
|
||||
func TestCommandFailure(t *testing.T) {
|
||||
|
|
Loading…
Reference in a new issue