diff --git a/main.go b/main.go index d7fe05d..9ac9731 100644 --- a/main.go +++ b/main.go @@ -73,9 +73,7 @@ func main() { if selection != "" { // serve selection to the OS - if err := serveTxt(selection); err != nil { - log.Fatal(err) - } + serveTxt(selection) } case "restore": if len(history) == 0 { @@ -83,9 +81,7 @@ func main() { return } - if err := serveTxt(history[len(history)-1]); err != nil { - log.Fatal(err) - } + serveTxt(history[len(history)-1]) case "clear": // remove all history if *clearAll { @@ -167,16 +163,14 @@ func getHistory(rawPath string) (string, []string, error) { return histfile, history, nil } -func serveTxt(s string) error { +func serveTxt(s string) { bin, err := exec.LookPath("wl-copy") if err != nil { - return fmt.Errorf("couldn't find wl-copy: %v", err) + log.Printf("couldn't find wl-copy: %v\n", err) } cmd := exec.Cmd{Path: bin, Stdin: strings.NewReader(s)} if err := cmd.Run(); err != nil { - log.Printf("Error running wl-copy: %s", err) // don't abort, minor error + log.Printf("error running wl-copy: %s\n", err) } - - return nil } diff --git a/storer.go b/storer.go index a01f67d..2d9c8b1 100644 --- a/storer.go +++ b/storer.go @@ -4,7 +4,6 @@ import ( "encoding/json" "fmt" "io/ioutil" - "log" ) func store(text string, history []string, histfile string, max int, persist bool) error { @@ -42,9 +41,7 @@ func store(text string, history []string, histfile string, max int, persist bool // make the copy buffer available to all applications, // even when the source has disappeared if persist { - if err := serveTxt(text); err != nil { - log.Print(err) // don't abort, minor error - } + serveTxt(text) } return nil