Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(release): add Windows build target to GoReleaser (#856)
LinYushenc5fce5688724
diff --git a/.goreleaser.yml b/.goreleaser.ymlindex 5f949611d1..e61f09489f 100644--- a/.goreleaser.yml+++ b/.goreleaser.yml@@ -17,6 +17,7 @@ builds:goos:- darwin- linux+ - windowsgoarch:- amd64- arm64@@ -25,6 +26,10 @@ archives:- id: defaultformats:- tar.gz+ format_overrides:+ - goos: windows+ formats:+ - zipname_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"checksum:diff --git a/server/cmd/multica/cmd_daemon.go b/server/cmd/multica/cmd_daemon.goindex 089ea1a7b0..f23a775349 100644--- a/server/cmd/multica/cmd_daemon.go+++ b/server/cmd/multica/cmd_daemon.go@@ -8,10 +8,8 @@ import ("net/http""os""os/exec"- "os/signal""strconv""strings"- "syscall""time""github.com/spf13/cobra"@@ -156,7 +154,7 @@ func runDaemonBackground(cmd *cobra.Command) error {child := exec.Command(exePath, args...)child.Stdout = logFilechild.Stderr = logFile- child.SysProcAttr = &syscall.SysProcAttr{Setsid: true}+ child.SysProcAttr = daemonSysProcAttr()if err := child.Start(); err != nil {logFile.Close()@@ -274,7 +272,7 @@ func runDaemonForeground(cmd *cobra.Command) error {}cfg.CLIVersion = version- ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)+ ctx, stop := daemonNotifyContext(context.Background())defer stop()logger := logger_pkg.NewLogger("daemon")@@ -306,7 +304,7 @@ func runDaemonForeground(cmd *cobra.Command) error {}child.Stdout = logFilechild.Stderr = logFile- child.SysProcAttr = &syscall.SysProcAttr{Setsid: true}+ child.SysProcAttr = daemonSysProcAttr()if err := child.Start(); err != nil {logFile.Close()@@ -355,7 +353,7 @@ func runDaemonStop(cmd *cobra.Command, _ []string) error {return fmt.Errorf("find process %d: %w", int(pid), err)}- if err := process.Signal(syscall.SIGTERM); err != nil {+ if err := process.Signal(daemonStopSignal()); err != nil {return fmt.Errorf("stop daemon (pid %d): %w", int(pid), err)}diff --git a/server/cmd/multica/sysproc_unix.go b/server/cmd/multica/sysproc_unix.gonew file mode 100644index 0000000000..02efe4eafc--- /dev/null+++ b/server/cmd/multica/sysproc_unix.go@@ -0,0 +1,22 @@+//go:build !windows++package main++import (+ "context"+ "os"+ "os/signal"+ "syscall"+)++func daemonSysProcAttr() *syscall.SysProcAttr {+ return &syscall.SysProcAttr{Setsid: true}+}++func daemonNotifyContext(parent context.Context) (context.Context, context.CancelFunc) {+ return signal.NotifyContext(parent, syscall.SIGINT, syscall.SIGTERM)+}++func daemonStopSignal() os.Signal {+ return syscall.SIGTERM+}diff --git a/server/cmd/multica/sysproc_windows.go b/server/cmd/multica/sysproc_windows.gonew file mode 100644index 0000000000..389158ec1a--- /dev/null+++ b/server/cmd/multica/sysproc_windows.go@@ -0,0 +1,25 @@+//go:build windows++package main++import (+ "context"+ "os"+ "os/signal"+ "syscall"+)++func daemonSysProcAttr() *syscall.SysProcAttr {+ return &syscall.SysProcAttr{+ HideWindow: true,+ CreationFlags: syscall.CREATE_NEW_PROCESS_GROUP,+ }+}++func daemonNotifyContext(parent context.Context) (context.Context, context.CancelFunc) {+ return signal.NotifyContext(parent, os.Interrupt)+}++func daemonStopSignal() os.Signal {+ return os.Interrupt+}