From 4cf347407a4937cad00aa2f9e73af2a1c7db40ea Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Fri, 17 Apr 2020 19:15:42 +0200 Subject: [PATCH] [exec] Allow waiting for command to finish Signed-off-by: Knut Ahlers --- cmd/streamdeck/action_exec.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/streamdeck/action_exec.go b/cmd/streamdeck/action_exec.go index 42b1a58..c2e4937 100644 --- a/cmd/streamdeck/action_exec.go +++ b/cmd/streamdeck/action_exec.go @@ -35,5 +35,11 @@ func (actionExec) Execute(attributes map[string]interface{}) error { return errors.Wrap(err, "Unable to start command") } + // If "wait" is set and set to true start command and wait for execution + if v, ok := attributes["wait"].(bool); ok && v { + return errors.Wrap(command.Wait(), "Unable to execute command") + } + + // We don't wait so we release the process and don't care anymore return errors.Wrap(command.Process.Release(), "Unable to release process") }