mirror of
https://github.com/rwinkhart/libmutton.git
synced 2026-08-27 20:36:29 -04:00
Fix compilation for Windows
This commit is contained in:
+2
-2
@@ -5,16 +5,16 @@ package clip
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"syscall"
|
|
||||||
|
|
||||||
"github.com/rwinkhart/go-boilerplate/back"
|
"github.com/rwinkhart/go-boilerplate/back"
|
||||||
|
"github.com/rwinkhart/libmutton/global"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LaunchClipClearProcess launches the timed clipboard clearing process.
|
// LaunchClipClearProcess launches the timed clipboard clearing process.
|
||||||
// For non-interactive CLI implementations, an entirely separate process is created for this purpose.
|
// For non-interactive CLI implementations, an entirely separate process is created for this purpose.
|
||||||
func LaunchClipClearProcess(copySubject string) {
|
func LaunchClipClearProcess(copySubject string) {
|
||||||
cmd := exec.Command(os.Args[0], "clipclear")
|
cmd := exec.Command(os.Args[0], "clipclear")
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{Setsid: true}
|
cmd.SysProcAttr = global.GetSysProcAttr()
|
||||||
_ = back.WriteToStdin(cmd, copySubject)
|
_ = back.WriteToStdin(cmd, copySubject)
|
||||||
_ = cmd.Start()
|
_ = cmd.Start()
|
||||||
os.Exit(0) // use os.Exit directly since this version of this function is only meant for non-interactive CLI implementations
|
os.Exit(0) // use os.Exit directly since this version of this function is only meant for non-interactive CLI implementations
|
||||||
@@ -6,16 +6,16 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strconv"
|
"strconv"
|
||||||
"syscall"
|
|
||||||
|
|
||||||
"github.com/rwinkhart/go-boilerplate/back"
|
"github.com/rwinkhart/go-boilerplate/back"
|
||||||
|
"github.com/rwinkhart/libmutton/global"
|
||||||
)
|
)
|
||||||
|
|
||||||
// LaunchClipClearProcess launches the timed clipboard clearing process.
|
// LaunchClipClearProcess launches the timed clipboard clearing process.
|
||||||
// For non-interactive CLI implementations, an entirely separate process is created for this purpose.
|
// For non-interactive CLI implementations, an entirely separate process is created for this purpose.
|
||||||
func LaunchClipClearProcess(copySubject string, isWayland bool) {
|
func LaunchClipClearProcess(copySubject string, isWayland bool) {
|
||||||
cmd := exec.Command(os.Args[0], "clipclear", strconv.FormatBool(isWayland))
|
cmd := exec.Command(os.Args[0], "clipclear", strconv.FormatBool(isWayland))
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{Setsid: true}
|
cmd.SysProcAttr = global.GetSysProcAttr()
|
||||||
_ = back.WriteToStdin(cmd, copySubject)
|
_ = back.WriteToStdin(cmd, copySubject)
|
||||||
_ = cmd.Start()
|
_ = cmd.Start()
|
||||||
os.Exit(0) // use os.Exit directly since this version of this function is only meant for non-interactive CLI implementations
|
os.Exit(0) // use os.Exit directly since this version of this function is only meant for non-interactive CLI implementations
|
||||||
+1
-2
@@ -6,7 +6,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
|
||||||
|
|
||||||
"github.com/rwinkhart/go-boilerplate/back"
|
"github.com/rwinkhart/go-boilerplate/back"
|
||||||
"github.com/rwinkhart/libmutton/global"
|
"github.com/rwinkhart/libmutton/global"
|
||||||
@@ -85,7 +84,7 @@ func launchRCWDProcess() []byte {
|
|||||||
|
|
||||||
if Daemonize {
|
if Daemonize {
|
||||||
cmd := exec.Command(os.Args[0], "startrcwd")
|
cmd := exec.Command(os.Args[0], "startrcwd")
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{Setsid: true}
|
cmd.SysProcAttr = global.GetSysProcAttr()
|
||||||
_ = back.WriteToStdin(cmd, string(password))
|
_ = back.WriteToStdin(cmd, string(password))
|
||||||
_ = cmd.Start()
|
_ = cmd.Start()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
//go:build !windows
|
||||||
|
|
||||||
|
package global
|
||||||
|
|
||||||
|
import "syscall"
|
||||||
|
|
||||||
|
func GetSysProcAttr() *syscall.SysProcAttr {
|
||||||
|
return &syscall.SysProcAttr{Setsid: true}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
//go:build windows
|
||||||
|
|
||||||
|
package global
|
||||||
|
|
||||||
|
import "syscall"
|
||||||
|
|
||||||
|
func GetSysProcAttr() *syscall.SysProcAttr {
|
||||||
|
return &syscall.SysProcAttr{}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user