Fix building for many non-Linux platforms

This commit is contained in:
2025-05-11 00:41:44 -04:00
parent 491392562a
commit dfb5c10dcb
7 changed files with 26 additions and 14 deletions
+5 -3
View File
@@ -4,15 +4,17 @@ package core
import (
"os/exec"
"github.com/rwinkhart/go-boilerplate/back"
)
// copyString copies a string to the clipboard.
func copyString(continuous bool, copySubject string) {
cmd := exec.Command("termux-clipboard-set")
writeToStdin(cmd, copySubject)
back.WriteToStdin(cmd, copySubject)
err := cmd.Run()
if err != nil {
PrintError("Failed to copy to clipboard: "+err.Error(), ErrorClipboard, true)
back.PrintError("Failed to copy to clipboard: "+err.Error(), ErrorClipboard, true)
}
if !continuous {
@@ -23,6 +25,6 @@ func copyString(continuous bool, copySubject string) {
// getClipCommands returns the commands for pasting and clearing the clipboard contents.
func getClipCommands() (*exec.Cmd, *exec.Cmd) {
cmdClear := exec.Command("termux-clipboard-set")
writeToStdin(cmdClear, "")
back.WriteToStdin(cmdClear, "")
return exec.Command("termux-clipboard-get"), cmdClear
}