mirror of
https://github.com/rwinkhart/libmutton.git
synced 2026-08-27 20:36:29 -04:00
Ensure clipboard remains set after CLI terminal closure on Linux+FreeBSD (bug only occured in very specific environments)
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
|||||||
|
|
||||||
"github.com/rwinkhart/go-boilerplate/back"
|
"github.com/rwinkhart/go-boilerplate/back"
|
||||||
"github.com/rwinkhart/go-boilerplate/security"
|
"github.com/rwinkhart/go-boilerplate/security"
|
||||||
|
"github.com/rwinkhart/libmutton/global"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CopyBytes copies a byte slice to the clipboard.
|
// CopyBytes copies a byte slice to the clipboard.
|
||||||
@@ -24,6 +25,7 @@ func CopyBytes(clearClipboardAutomatically bool, copySubject []byte) error {
|
|||||||
} else {
|
} else {
|
||||||
cmdCopy = exec.Command("xclip", "-sel", "c", "-t", "text/plain")
|
cmdCopy = exec.Command("xclip", "-sel", "c", "-t", "text/plain")
|
||||||
}
|
}
|
||||||
|
cmdCopy.SysProcAttr = global.GetSysProcAttr()
|
||||||
|
|
||||||
_ = back.WriteToStdin(cmdCopy, copySubject, false)
|
_ = back.WriteToStdin(cmdCopy, copySubject, false)
|
||||||
if err = cmdCopy.Run(); err != nil {
|
if err = cmdCopy.Run(); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user