(writer *zip.Writer, pathInZip string, data []byte)
| 42 | } |
| 43 | |
| 44 | func writeExe(writer *zip.Writer, pathInZip string, data []byte) error { |
| 45 | if pathInZip != "bootstrap" { |
| 46 | header := &zip.FileHeader{Name: "bootstrap", Method: zip.Deflate} |
| 47 | header.SetMode(0755 | os.ModeSymlink) |
| 48 | link, err := writer.CreateHeader(header) |
| 49 | if err != nil { |
| 50 | return err |
| 51 | } |
| 52 | if _, err := link.Write([]byte(pathInZip)); err != nil { |
| 53 | return err |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | exe, err := writer.CreateHeader(&zip.FileHeader{ |
| 58 | CreatorVersion: 3 << 8, // indicates Unix |
| 59 | ExternalAttrs: 0777 << 16, // -rwxrwxrwx file permissions |
| 60 | Name: pathInZip, |
| 61 | Method: zip.Deflate, |
| 62 | }) |
| 63 | if err != nil { |
| 64 | return err |
| 65 | } |
| 66 | |
| 67 | _, err = exe.Write(data) |
| 68 | return err |
| 69 | } |
| 70 | |
| 71 | func compressExeAndArgs(outZipPath string, exePath string, args []string) error { |
| 72 | zipFile, err := os.Create(outZipPath) |
no test coverage detected
searching dependent graphs…