Ensure clipboard remains set after CLI terminal closure on Linux+FreeBSD (bug only occured in very specific environments)

This commit is contained in:
2026-02-17 20:30:35 -05:00
parent e9f49fb98a
commit 83f59c3cd9
+2
View File
@@ -9,6 +9,7 @@ import (
"github.com/rwinkhart/go-boilerplate/back"
"github.com/rwinkhart/go-boilerplate/security"
"github.com/rwinkhart/libmutton/global"
)
// CopyBytes copies a byte slice to the clipboard.
@@ -24,6 +25,7 @@ func CopyBytes(clearClipboardAutomatically bool, copySubject []byte) error {
} else {
cmdCopy = exec.Command("xclip", "-sel", "c", "-t", "text/plain")
}
cmdCopy.SysProcAttr = global.GetSysProcAttr()
_ = back.WriteToStdin(cmdCopy, copySubject, false)
if err = cmdCopy.Run(); err != nil {