Skip to content

Commit 711515f

Browse files
committed
Backport 8f4590c, bc79317, 6d1513b
1 parent da5cc80 commit 711515f

File tree

5 files changed

+23
-0
lines changed

5 files changed

+23
-0
lines changed

core/launchClipClearProcessCLIGeneric.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ import (
77
"os/exec"
88

99
"github.com/rwinkhart/go-boilerplate/back"
10+
"github.com/rwinkhart/libmutton/global"
1011
)
1112

1213
// LaunchClipClearProcess launches the timed clipboard clearing process.
1314
// For non-interactive CLI implementations, an entirely separate process is created for this purpose.
1415
func LaunchClipClearProcess(copySubject string) {
1516
cmd := exec.Command(os.Args[0], "clipclear")
17+
cmd.SysProcAttr = global.GetSysProcAttr()
1618
_ = back.WriteToStdin(cmd, copySubject)
1719
_ = cmd.Start()
1820
os.Exit(0) // use os.Exit directly since this version of this function is only meant for non-interactive CLI implementations

core/launchClipClearProcessCLIUNIX.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ import (
88
"strconv"
99

1010
"github.com/rwinkhart/go-boilerplate/back"
11+
"github.com/rwinkhart/libmutton/global"
1112
)
1213

1314
// LaunchClipClearProcess launches the timed clipboard clearing process.
1415
// For non-interactive CLI implementations, an entirely separate process is created for this purpose.
1516
func LaunchClipClearProcess(copySubject string, isWayland bool) {
1617
cmd := exec.Command(os.Args[0], "clipclear", strconv.FormatBool(isWayland))
18+
cmd.SysProcAttr = global.GetSysProcAttr()
1719
_ = back.WriteToStdin(cmd, copySubject)
1820
_ = cmd.Start()
1921
os.Exit(0) // use os.Exit directly since this version of this function is only meant for non-interactive CLI implementations

crypt/rcw.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ func launchRCWDProcess() []byte {
8484

8585
if Daemonize {
8686
cmd := exec.Command(os.Args[0], "startrcwd")
87+
cmd.SysProcAttr = global.GetSysProcAttr()
8788
_ = back.WriteToStdin(cmd, string(password))
8889
_ = cmd.Start()
8990
}

global/sysProcAttr_UNIX.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//go:build !windows
2+
3+
package global
4+
5+
import "syscall"
6+
7+
func GetSysProcAttr() *syscall.SysProcAttr {
8+
return &syscall.SysProcAttr{Setsid: true}
9+
}

global/sysProcAttr_WIN.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//go:build windows
2+
3+
package global
4+
5+
import "syscall"
6+
7+
func GetSysProcAttr() *syscall.SysProcAttr {
8+
return &syscall.SysProcAttr{CreationFlags: syscall.CREATE_NEW_PROCESS_GROUP}
9+
}

0 commit comments

Comments
 (0)