diff --git a/android/bazel_handler.go b/android/bazel_handler.go index 0ed973a45..a5fa04322 100644 --- a/android/bazel_handler.go +++ b/android/bazel_handler.go @@ -767,9 +767,9 @@ func (context *bazelContext) InvokeBazel(config Config) error { cqueryOutput, cqueryErr, err := context.issueBazelCommand(context.paths, bazel.CqueryBuildRootRunName, cqueryCmd, "--output=starlark", "--starlark:file="+absolutePath(cqueryFileRelpath)) if err != nil { - _ = ioutil.WriteFile(filepath.Join(soongInjectionPath, "cquery.out"), []byte(cqueryOutput), 0666) + return err } - if err != nil { + if err = ioutil.WriteFile(filepath.Join(soongInjectionPath, "cquery.out"), []byte(cqueryOutput), 0666); err != nil { return err }