e2e/cli/command: Wait() after execution

This commit is contained in:
Lars Lehtonen 2019-11-15 16:47:25 -08:00
parent a046a96d5e
commit c9383ca17d
No known key found for this signature in database
GPG Key ID: 8137D474EBCB04F2
1 changed files with 7 additions and 1 deletions

View File

@ -192,7 +192,6 @@ func (c *Run) runTest(opts *runOpts) (*TestReport, error) {
cmd := exec.Command(goBin, opts.goArgs()...)
cmd.Env = opts.goEnv()
out, err := cmd.StdoutPipe()
defer out.Close()
if err != nil {
return nil, err
}
@ -202,6 +201,13 @@ func (c *Run) runTest(opts *runOpts) (*TestReport, error) {
return nil, err
}
err = cmd.Wait()
if err != nil {
// should command fail, log here then proceed to generate test report
// to report more informative info about which tests fail
c.logger.Error("test command failed", "error", err)
}
dec := NewDecoder(out)
report, err := dec.Decode(c.logger.Named("run.gotest"))
if err != nil {