execKeytool will execute a "keytool" command and if needed re-execute the command with commandWithSudo to work around file permissions.
(cmd *exec.Cmd)
| 108 | // execKeytool will execute a "keytool" command and if needed re-execute |
| 109 | // the command with commandWithSudo to work around file permissions. |
| 110 | func execKeytool(cmd *exec.Cmd) ([]byte, error) { |
| 111 | out, err := cmd.CombinedOutput() |
| 112 | if err != nil && bytes.Contains(out, []byte("java.io.FileNotFoundException")) && runtime.GOOS != "windows" { |
| 113 | origArgs := cmd.Args[1:] |
| 114 | cmd = commandWithSudo(cmd.Path) |
| 115 | cmd.Args = append(cmd.Args, origArgs...) |
| 116 | cmd.Env = []string{ |
| 117 | "JAVA_HOME=" + javaHome, |
| 118 | } |
| 119 | out, err = cmd.CombinedOutput() |
| 120 | } |
| 121 | return out, err |
| 122 | } |
no test coverage detected
searching dependent graphs…