Skip to content

Commit ded03a4

Browse files
committed
fix: build
1 parent d381cff commit ded03a4

4 files changed

Lines changed: 42 additions & 19 deletions

File tree

launcher/FyneApp.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[Details]
2+
Icon = ""
3+
Name = "Mnemoo Tools Launcher"
4+
ID = "com.mnemoo.mtools-launcher"
5+
Version = "1.0.0"
6+
Build = 1

launcher/main.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"runtime"
1212
"strings"
1313
"sync"
14-
"syscall"
1514

1615
"fyne.io/fyne/v2"
1716
"fyne.io/fyne/v2/app"
@@ -56,17 +55,6 @@ func (pm *ProcessManager) StopAll() {
5655
}
5756
}
5857

59-
// killProcessGroup kills a process and all its children
60-
func killProcessGroup(pid int) {
61-
// On Unix, kill the process group by using negative PID
62-
if runtime.GOOS != "windows" {
63-
syscall.Kill(-pid, syscall.SIGKILL)
64-
} else {
65-
// On Windows, use taskkill /T to kill tree
66-
exec.Command("taskkill", "/F", "/T", "/PID", fmt.Sprint(pid)).Run()
67-
}
68-
}
69-
7058
// killProcessByPort kills any process listening on the specified port
7159
func killProcessByPort(port string) error {
7260
if runtime.GOOS == "windows" {
@@ -79,13 +67,6 @@ func killProcessByPort(port string) error {
7967
return cmd.Run()
8068
}
8169

82-
// setupProcessGroup configures cmd to run in its own process group
83-
func setupProcessGroup(cmd *exec.Cmd) {
84-
if runtime.GOOS != "windows" {
85-
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
86-
}
87-
}
88-
8970
func checkCommand(name string, args ...string) (bool, string) {
9071
cmd := exec.Command(name, args...)
9172
output, err := cmd.Output()

launcher/process_unix.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//go:build !windows
2+
3+
package main
4+
5+
import (
6+
"os/exec"
7+
"syscall"
8+
)
9+
10+
// killProcessGroup kills a process and all its children on Unix
11+
func killProcessGroup(pid int) {
12+
syscall.Kill(-pid, syscall.SIGKILL)
13+
}
14+
15+
// setupProcessGroup configures cmd to run in its own process group on Unix
16+
func setupProcessGroup(cmd *exec.Cmd) {
17+
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
18+
}

launcher/process_windows.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//go:build windows
2+
3+
package main
4+
5+
import (
6+
"fmt"
7+
"os/exec"
8+
)
9+
10+
// killProcessGroup kills a process and all its children on Windows
11+
func killProcessGroup(pid int) {
12+
exec.Command("taskkill", "/F", "/T", "/PID", fmt.Sprint(pid)).Run()
13+
}
14+
15+
// setupProcessGroup is a no-op on Windows (process groups work differently)
16+
func setupProcessGroup(cmd *exec.Cmd) {
17+
// Windows doesn't use Setpgid, process tree killing is handled by taskkill /T
18+
}

0 commit comments

Comments
 (0)