cmd/gomobile: use Output instead of CombinedOutput at envClang
It dosen't make sense to parse stdout and stderr to get a necessary information like clang command. Actually envClang sometimes didn't work correctly due to this. Fixes golang/go#53316 Change-Id: Ia2c518c44c0003b4f9b50dba85fb971c2ef4340d Reviewed-on: https://go-review.googlesource.com/c/mobile/+/620315 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
Родитель
08a83c5af9
Коммит
7ff83004ec
|
@ -436,15 +436,21 @@ func envClang(sdkName string) (clang, cflags string, err error) {
|
|||
return sdkName + "-clang", "-isysroot " + sdkName, nil
|
||||
}
|
||||
cmd := exec.Command("xcrun", "--sdk", sdkName, "--find", "clang")
|
||||
out, err := cmd.CombinedOutput()
|
||||
out, err := cmd.Output()
|
||||
if err != nil {
|
||||
if ee := (*exec.ExitError)(nil); errors.As(err, &ee) {
|
||||
out = append(out, ee.Stderr...)
|
||||
}
|
||||
return "", "", fmt.Errorf("xcrun --find: %v\n%s", err, out)
|
||||
}
|
||||
clang = strings.TrimSpace(string(out))
|
||||
|
||||
cmd = exec.Command("xcrun", "--sdk", sdkName, "--show-sdk-path")
|
||||
out, err = cmd.CombinedOutput()
|
||||
out, err = cmd.Output()
|
||||
if err != nil {
|
||||
if ee := (*exec.ExitError)(nil); errors.As(err, &ee) {
|
||||
out = append(out, ee.Stderr...)
|
||||
}
|
||||
return "", "", fmt.Errorf("xcrun --show-sdk-path: %v\n%s", err, out)
|
||||
}
|
||||
sdk := strings.TrimSpace(string(out))
|
||||
|
|
Загрузка…
Ссылка в новой задаче