Specify a "Sudo password:" prompt for sudo

Fixes #178
Closes #185
This commit is contained in:
Filippo Valsorda
2019-08-16 17:47:28 -04:00
parent 2d05f3b4d8
commit aa4dd61066
4 changed files with 28 additions and 20 deletions

View File

@@ -106,12 +106,12 @@ func (m *mkcert) uninstallJava() {
}
// execKeytool will execute a "keytool" command and if needed re-execute
// the command wrapped in 'sudo' to work around file permissions.
// the command with commandWithSudo to work around file permissions.
func (m *mkcert) execKeytool(cmd *exec.Cmd) ([]byte, error) {
out, err := cmd.CombinedOutput()
if err != nil && bytes.Contains(out, []byte("java.io.FileNotFoundException")) && runtime.GOOS != "windows" {
origArgs := cmd.Args[1:]
cmd = exec.Command("sudo", keytoolPath)
cmd = commandWithSudo(keytoolPath)
cmd.Args = append(cmd.Args, origArgs...)
cmd.Env = []string{
"JAVA_HOME=" + javaHome,