mirror of
https://github.com/rwinkhart/libmutton.git
synced 2026-09-03 07:37:28 -04:00
Fix build on many platforms
This commit is contained in:
+4
-4
@@ -9,10 +9,10 @@ import (
|
||||
"github.com/rwinkhart/go-boilerplate/back"
|
||||
)
|
||||
|
||||
// CopyString copies a string to the clipboard.
|
||||
func CopyString(clearClipboardAutomatically bool, copySubject string) error {
|
||||
// CopyBytes copies a byte slice to the clipboard.
|
||||
func CopyBytes(clearClipboardAutomatically bool, copySubject []byte) error {
|
||||
cmd := exec.Command("termux-clipboard-set")
|
||||
_ = back.WriteToStdin(cmd, copySubject)
|
||||
_ = back.WriteToStdinAndZeroizeInput(cmd, copySubject)
|
||||
if err := cmd.Run(); err != nil {
|
||||
return errors.New("unable to copy to clipboard: " + err.Error())
|
||||
}
|
||||
@@ -25,6 +25,6 @@ func CopyString(clearClipboardAutomatically bool, copySubject string) error {
|
||||
// getClipCommands returns the commands for pasting and clearing the clipboard contents.
|
||||
func getClipCommands() (*exec.Cmd, *exec.Cmd, error) {
|
||||
cmdClear := exec.Command("termux-clipboard-set")
|
||||
_ = back.WriteToStdin(cmdClear, "")
|
||||
_ = back.WriteToStdinAndZeroizeInput(cmdClear, nil)
|
||||
return exec.Command("termux-clipboard-get"), cmdClear, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user