I want to create an exec.Cmd array and connect them together to make a squid authenticator. It works when the commands in the file have no arguments. With arguments, he reads only EOF . I checked the argv array and its contents are fine.
Relevant piece of code:
func initCmd(file *os.File) []* exec.Cmd {
var cmd [MAX_PROC]* exec.Cmd;
var e os.Error
environ := os.Environ();
var i int
for i=0; i < MAX_PROC; i++ {
line := getLine(file)
if line == "" { break }
parts := strings.Fields(line)
cmd[i], e = exec.Run(parts[0], parts[1:], environ,
exec.Pipe, exec.Pipe, exec.Pipe)
exitOnError(&e)
}
return cmd[0:i]
}
Any ideas? Thank.
PS: If this helps, the full source of the program is on github .
source
share