Skip to content

Commit

Permalink
Use csv reader to parse quoted command parameters in ExecBee
Browse files Browse the repository at this point in the history
  • Loading branch information
muesli committed Feb 22, 2020
1 parent 8eb5a35 commit e8b2cee
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion bees/execbee/execbee.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ package execbee

import (
"bufio"
"encoding/csv"
"io"
"os/exec"
"strings"
Expand Down Expand Up @@ -54,7 +55,14 @@ func (mod *ExecBee) Action(action bees.Action) []bees.Placeholder {
mod.Logln("Executing locally: ", command)

go func() {
c := strings.Split(command, " ")
r := csv.NewReader(strings.NewReader(command))
r.Comma = ' ' // space
c, err := r.Read()
if err != nil {
mod.LogErrorf("Error parsing command: %v", err)
return
}

cmd := exec.Command(c[0], c[1:]...)

if stdin != "" {
Expand Down

0 comments on commit e8b2cee

Please sign in to comment.