Skip to content

Commit

Permalink
Exec command in background and wait for it to complete
Browse files Browse the repository at this point in the history
  • Loading branch information
muesli committed Mar 26, 2020
1 parent c3d97f8 commit b19ba0a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion deck.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ func executeCommand(cmd string) {
if err := c.Start(); err != nil {
panic(err)
}
err := c.Wait()
if err != nil {
log.Printf("command failed: %s", err)
}
}

// triggerAction triggers an action
Expand Down Expand Up @@ -119,7 +123,7 @@ func (d *Deck) triggerAction(index uint8, hold bool) {
executeDBusMethod(a.DBus.Object, a.DBus.Path, a.DBus.Method, a.DBus.Value)
}
if a.Exec != "" {
executeCommand(a.Exec)
go executeCommand(a.Exec)
}
} else {
w.TriggerAction()
Expand Down

0 comments on commit b19ba0a

Please sign in to comment.