소스 검색

Swap exec.Command("hostname") for os.Hostname() (#137)

David Crawshaw 6 년 전
부모
커밋
c03e3ceaca
1개의 변경된 파일2개의 추가작업 그리고 3개의 파일을 삭제
  1. 2 3
      cert.go

+ 2 - 3
cert.go

@@ -20,7 +20,6 @@ import (
 	"math/big"
 	"net"
 	"os"
-	"os/exec"
 	"os/user"
 	"path/filepath"
 	"regexp"
@@ -38,8 +37,8 @@ func init() {
 	if u != nil {
 		userAndHostname = u.Username + "@"
 	}
-	out, _ := exec.Command("hostname").Output()
-	userAndHostname += strings.TrimSpace(string(out))
+	hostname, _ := os.Hostname()
+	userAndHostname += hostname
 }
 
 func (m *mkcert) makeCert(hosts []string) {