mirror of
https://github.com/golang/go
synced 2024-10-06 08:00:07 +00:00
cmd/go/internal/script: check lack of error for non-waiting cmds
In the script engine, if a command does not return a Wait function and it succeeds, we won't call checkStatus. That means that commands that don't have a wait function, have a "!" indicating that they are supposed to fail, and then succeed will spuriously not fail the script engine test even they were supposed to fail but didn't. Change-Id: Ic88c3cdd628064d48f14a8a4a2e97cded48890fb Reviewed-on: https://go-review.googlesource.com/c/go/+/451284 Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Matloob <matloob@golang.org>
This commit is contained in:
parent
6fc1f4f906
commit
7161fc737d
|
@ -564,11 +564,14 @@ func (e *Engine) runCommand(s *State, cmd *command, impl Cmd) error {
|
|||
}
|
||||
|
||||
wait, runErr := impl.Run(s, cmd.args...)
|
||||
if runErr != nil {
|
||||
if wait == nil {
|
||||
if async && runErr == nil {
|
||||
return cmdError(cmd, errors.New("internal error: async command returned a nil WaitFunc"))
|
||||
}
|
||||
return checkStatus(cmd, runErr)
|
||||
}
|
||||
if async && wait == nil {
|
||||
return cmdError(cmd, errors.New("internal error: async command returned a nil WaitFunc"))
|
||||
if runErr != nil {
|
||||
return cmdError(cmd, errors.New("internal error: command returned both an error and a WaitFunc"))
|
||||
}
|
||||
|
||||
if cmd.background {
|
||||
|
|
|
@ -4,9 +4,10 @@
|
|||
# leading the package matching code to think there were Go files in the
|
||||
# directory.)
|
||||
|
||||
cd bar
|
||||
go list ./...
|
||||
! stdout .
|
||||
|
||||
cd ..
|
||||
|
||||
[short] skip
|
||||
|
||||
|
|
Loading…
Reference in a new issue