for consistency symlink_tree failure = os.Exit(1)
Brings down time taken to fail from 18s to 13s (on aosp branch)
Test: temporarily coded random failure
Bug: N/A
Change-Id: Ib694eec977293f4dd7054e779d1b82b8cace93f6
diff --git a/bp2build/symlink_forest.go b/bp2build/symlink_forest.go
index 4a4ae9e..667b952 100644
--- a/bp2build/symlink_forest.go
+++ b/bp2build/symlink_forest.go
@@ -50,7 +50,6 @@
depCh chan string
mkdirCount atomic.Uint64
symlinkCount atomic.Uint64
- okay atomic.Bool // Whether the forest was successfully constructed
}
// A simple thread pool to limit concurrency on system calls.
@@ -366,14 +365,14 @@
if err != nil {
fmt.Fprintf(os.Stderr, "Error merging %s and %s: %s",
srcBuildFile, generatedBuildFile, err)
- context.okay.Store(false)
+ os.Exit(1)
}
} else {
// Both exist and one is a file. This is an error.
fmt.Fprintf(os.Stderr,
"Conflict in workspace symlink tree creation: both '%s' and '%s' exist and exactly one is a directory\n",
srcChild, buildFilesChild)
- context.okay.Store(false)
+ os.Exit(1)
}
}
}
@@ -436,8 +435,6 @@
symlinkCount: atomic.Uint64{},
}
- context.okay.Store(true)
-
removeParallel(shared.JoinPath(topdir, forest))
instructions := instructionsFromExcludePathList(exclude)
@@ -452,9 +449,5 @@
deps = append(deps, dep)
}
- if !context.okay.Load() {
- os.Exit(1)
- }
-
return deps, context.mkdirCount.Load(), context.symlinkCount.Load()
}