Not optimal, but workable.

This commit is contained in:
Josh Mudge 2019-11-11 21:31:06 -07:00
parent e1ff342fce
commit ccd254cd99
1 changed files with 4 additions and 3 deletions

View File

@ -47,10 +47,11 @@ func main() {
//Create firewall rule
cmdinstance := exec.Command("powershell.exe", "-WindowStyle", "Hidden", "-Command", "New-NetFirewallRule", "-DisplayName", "'Go Web Server'", "-Direction", "Inbound", file, "-Action", "Allow")
cmdinstance.SysProcAttr = &syscall.SysProcAttr{HideWindow: true} // Make it silent.
cmdinstance2 := exec.Command("start", "cmd", "/C", "start", "server.exe")
cmdinstance2 := exec.Command("cmd", "/C", "start", "http://localhost:8100")
cmdinstance2.SysProcAttr = &syscall.SysProcAttr{HideWindow: true} // Make it silent.
cmdinstance3 := exec.Command("cmd", "/C", "start", "http://localhost:8100")
cmdinstance3 := exec.Command("cmd", "start", "server.exe")
cmdinstance3.SysProcAttr = &syscall.SysProcAttr{HideWindow: true} // Make it silent.
cmdoutput, cmderr := cmdinstance.Output()
if cmderr != nil {
fmt.Println(cmderr)