Skip to content

Commit b5116ec

Browse files
committed
Add kill options for windows
1 parent 5464e85 commit b5116ec

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

killbrowser_windows.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package main
2+
3+
import "os/exec"
4+
5+
func findBrowser(process string) ([]byte, error) {
6+
return []byte(process), nil
7+
}
8+
9+
func killBrowser(process string) ([]byte, error) {
10+
cmd := exec.Command("pskill", process)
11+
return cmd.Output()
12+
}
13+
14+
func startBrowser(command []byte, url string) ([]byte, error) {
15+
cmd := exec.Command("start", string(command), url)
16+
return cmd.Output()
17+
}

main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ func main() {
241241
r.Handle("WS", "/socket.io/", socketHandler)
242242
r.Handle("WSS", "/socket.io/", socketHandler)
243243
r.GET("/info", infoHandler)
244+
r.POST("/killbrowser", killBrowserHandler)
245+
244246
go func() {
245247
// check if certificates exist; if not, use plain http
246248
if _, err := os.Stat(filepath.Join(dest, "cert.pem")); os.IsNotExist(err) {

0 commit comments

Comments
 (0)