cmd/gomobile: Fix issue in init when downloading full NDK.
Fixes an issue where the full NDK could not be downloaded due to a missing execute permission.
Fixes golang/go#12208
Change-Id: I6f432b5021b082693a02a293f50caf6da4d4e379
Reviewed-on: https://go-review.googlesource.com/13669
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
diff --git a/cmd/gomobile/init.go b/cmd/gomobile/init.go
index b03732f..137ee36 100644
--- a/cmd/gomobile/init.go
+++ b/cmd/gomobile/init.go
@@ -435,6 +435,10 @@
// is not used, and 7z.exe is not a normal dependency.
var inflate *exec.Cmd
if goos != "windows" {
+ // The downloaded archive is executed on linux and os x to unarchive.
+ // To do this execute permissions are needed.
+ os.Chmod(archive, 0755)
+
inflate = exec.Command(archive)
} else {
inflate = exec.Command("7z.exe", "x", archive)