Add support for complex commands

This commit is contained in:
Leonid Bugaev
2015-06-28 00:23:21 +05:00
parent 674ffc6202
commit 98f941b69a
2 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ dbench:
# Used mainly for debugging, because docker container do not have access to parent machine ports
drun:
docker run -v `pwd`:/gopath/src/gor -t -i gor go run $(SOURCE) --input-modifier="./examples/echo_modifier.sh" --input-dummy=0 --output-http="http://localhost:9000" --verbose
docker run -v `pwd`:/gopath/src/gor -t -i gor go run $(SOURCE) --input-modifier="bash ./examples/echo_modifier.sh" --input-dummy=0 --output-http="http://localhost:9000" --verbose
dbash:
docker run -v `pwd`:/gopath/src/gor -t -i gor /bin/bash
+3 -1
View File
@@ -8,6 +8,7 @@ import (
"log"
"os"
"os/exec"
"strings"
)
type TrafficModifier struct {
@@ -26,7 +27,8 @@ func NewTrafficModifier(plugin interface{}, command string) io.Reader {
m.command = command
m.data = make(chan []byte)
cmd := exec.Command(command)
commands := strings.Split(command, " ")
cmd := exec.Command(commands[0], commands[1:]...)
m.Stdout, _ = cmd.StdoutPipe()
m.Stdin, _ = cmd.StdinPipe()