cd to / before running soong_build .
This lets one avoid any decisions as to when to chdir there during its execution and leads to better sandboxing because the pwd doesn't leak to init() functions anymore. Test: Manual. Change-Id: I1560da8ed3a621249426f9e8908aa890c21e13ba
This commit is contained in:
@@ -30,6 +30,21 @@ type SharedPaths interface {
|
||||
BazelMetricsDir() string
|
||||
}
|
||||
|
||||
// Joins the path strings in the argument list, taking absolute paths into
|
||||
// account. That is, if one of the strings is an absolute path, the ones before
|
||||
// are ignored.
|
||||
func JoinPath(base string, rest ...string) string {
|
||||
result := base
|
||||
for _, next := range rest {
|
||||
if filepath.IsAbs(next) {
|
||||
result = next
|
||||
} else {
|
||||
result = filepath.Join(result, next)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// Given the out directory, returns the root of the temp directory (to be cleared at the start of each execution of Soong)
|
||||
func TempDirForOutDir(outDir string) (tempPath string) {
|
||||
return filepath.Join(outDir, ".temp")
|
||||
|
Reference in New Issue
Block a user