This commit is contained in:
2025-11-23 03:53:57 -05:00
parent da5cc80005
commit 711515f3a1
5 changed files with 23 additions and 0 deletions
+2
View File
@@ -7,12 +7,14 @@ import (
"os/exec"
"github.com/rwinkhart/go-boilerplate/back"
"github.com/rwinkhart/libmutton/global"
)
// LaunchClipClearProcess launches the timed clipboard clearing process.
// For non-interactive CLI implementations, an entirely separate process is created for this purpose.
func LaunchClipClearProcess(copySubject string) {
cmd := exec.Command(os.Args[0], "clipclear")
cmd.SysProcAttr = global.GetSysProcAttr()
_ = back.WriteToStdin(cmd, copySubject)
_ = cmd.Start()
os.Exit(0) // use os.Exit directly since this version of this function is only meant for non-interactive CLI implementations
+2
View File
@@ -8,12 +8,14 @@ import (
"strconv"
"github.com/rwinkhart/go-boilerplate/back"
"github.com/rwinkhart/libmutton/global"
)
// LaunchClipClearProcess launches the timed clipboard clearing process.
// For non-interactive CLI implementations, an entirely separate process is created for this purpose.
func LaunchClipClearProcess(copySubject string, isWayland bool) {
cmd := exec.Command(os.Args[0], "clipclear", strconv.FormatBool(isWayland))
cmd.SysProcAttr = global.GetSysProcAttr()
_ = back.WriteToStdin(cmd, copySubject)
_ = cmd.Start()
os.Exit(0) // use os.Exit directly since this version of this function is only meant for non-interactive CLI implementations
+1
View File
@@ -84,6 +84,7 @@ func launchRCWDProcess() []byte {
if Daemonize {
cmd := exec.Command(os.Args[0], "startrcwd")
cmd.SysProcAttr = global.GetSysProcAttr()
_ = back.WriteToStdin(cmd, string(password))
_ = cmd.Start()
}
+9
View File
@@ -0,0 +1,9 @@
//go:build !windows
package global
import "syscall"
func GetSysProcAttr() *syscall.SysProcAttr {
return &syscall.SysProcAttr{Setsid: true}
}
+9
View File
@@ -0,0 +1,9 @@
//go:build windows
package global
import "syscall"
func GetSysProcAttr() *syscall.SysProcAttr {
return &syscall.SysProcAttr{CreationFlags: syscall.CREATE_NEW_PROCESS_GROUP}
}