Skip to content

Commit

Permalink
fixes adjusting arguments passed to executor
Browse files Browse the repository at this point in the history
- it is not guaranteed that the cmd arguments will be correctly parsed
when the glow framework adds a new argument to the end of the arguments
- glow's specific arguments should be always flags and should be before
program's arguments, because the program can have both flag arguments and
non-flag arguments. That can cause problems because Golang won't
parse flags as flag arguments that are after a non-flag arguments.

Example:

-glow.flag1 -glow.flag2 other_argument -glow.flag3

the glow.flag3 is not parsed as a flag argument
  • Loading branch information
radike committed Apr 21, 2016
1 parent a2af298 commit c5dca37
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions agent/agent_server_executor_start.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ func (as *AgentServer) handleStart(conn net.Conn,
}

func (as *AgentServer) adjustArgs(args []string, requestId uint32) (ret []string) {
ret = []string{"-glow.request.id", fmt.Sprintf("%d", requestId)}

if as.Option.CertFiles.IsEnabled() {
var cleanedArgs []string
for _, arg := range args {
Expand All @@ -92,10 +94,8 @@ func (as *AgentServer) adjustArgs(args []string, requestId uint32) (ret []string
}
}
} else {
ret = args
ret = append(ret, args...)
}
ret = append(ret, "-glow.request.id")
ret = append(ret, fmt.Sprintf("%d", requestId))

// fmt.Printf("cmd: %v\n", ret)
return
Expand Down

0 comments on commit c5dca37

Please sign in to comment.