fix: don't kill demon on wl-clipboard errors
This commit is contained in:
parent
a64d7bdf66
commit
7f5078bfdb
2 changed files with 4 additions and 7 deletions
7
demon.go
7
demon.go
|
@ -2,7 +2,6 @@ package main
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os/exec"
|
||||
|
@ -42,7 +41,7 @@ func filter(history []string, text string) []string {
|
|||
return history
|
||||
}
|
||||
|
||||
func listen(history []string, histfile string, persist bool, max int) error {
|
||||
func listen(history []string, histfile string, persist bool, max int) {
|
||||
for {
|
||||
|
||||
t, err := exec.Command("wl-paste", "-n").CombinedOutput()
|
||||
|
@ -90,14 +89,14 @@ func listen(history []string, histfile string, persist bool, max int) error {
|
|||
// dump history to file so that other apps can query it
|
||||
err = write(history, histfile)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error writing history (demon.83): %s", err)
|
||||
log.Fatalf("Fatal error writing history (demon.83): %s", err)
|
||||
}
|
||||
|
||||
if persist {
|
||||
// make the copy buffer available to all applications,
|
||||
// even when the source has disappeared
|
||||
if err := exec.Command("wl-copy", []string{"--", text}...).Run(); err != nil {
|
||||
return fmt.Errorf("error running wl-copy (demon.91): %s", err)
|
||||
log.Printf("Error running wl-copy (demon.91): %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
4
main.go
4
main.go
|
@ -42,9 +42,7 @@ func main() {
|
|||
|
||||
if *asDemon {
|
||||
persist := !*noPersist
|
||||
if err := listen(history, histfile, persist, *max); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
listen(history, histfile, persist, *max)
|
||||
} else if *asSelector {
|
||||
if err := selector(history, *max, *tool); err != nil {
|
||||
log.Fatal(err)
|
||||
|
|
Loading…
Reference in a new issue