Skip to content

Commit

Permalink
better error with cmd like foo |
Browse files Browse the repository at this point in the history
  • Loading branch information
Dieterbe committed Oct 31, 2014
1 parent 1b2de7e commit ffb7010
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions influx-cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,11 @@ func handle(cmd string) {
cmdArr := strings.Split(cmd, "|")
cmd = cmdArr[0]
cmdAndArgs := strings.Fields(cmdArr[1])
if len(cmdAndArgs) < 2 {
fmt.Fprintln(os.Stderr, "error: no command specified to pipe to")
Exit(2)
}

pipeTo = exec.Command(cmdAndArgs[0], cmdAndArgs[1:]...)
var err error
writeTo, err = pipeTo.StdinPipe()
Expand Down

0 comments on commit ffb7010

Please sign in to comment.