Merge pull request #40 from SoarinFerret/send-command-shell-fix
"Send Command" shell whitespace fix
This commit is contained in:
commit
d4faa2a233
1 changed files with 2 additions and 1 deletions
|
|
@ -306,7 +306,8 @@ func (a *Agent) CmdV2(c *CmdOptions) CmdStatus {
|
||||||
} else if c.IsExecutable {
|
} else if c.IsExecutable {
|
||||||
envCmd = gocmd.NewCmdOptions(cmdOptions, c.Shell, c.Command) // c.Shell: bin + c.Command: args as one string
|
envCmd = gocmd.NewCmdOptions(cmdOptions, c.Shell, c.Command) // c.Shell: bin + c.Command: args as one string
|
||||||
} else {
|
} else {
|
||||||
envCmd = gocmd.NewCmdOptions(cmdOptions, c.Shell, "-c", c.Command) // /bin/bash -c 'ls -l /var/log/...'
|
commandArray := append(strings.Fields(c.Shell), "-c", c.Command)
|
||||||
|
envCmd = gocmd.NewCmdOptions(cmdOptions, commandArray[0], commandArray[1:]...) // /bin/bash -c 'ls -l /var/log/...'
|
||||||
}
|
}
|
||||||
|
|
||||||
var stdoutBuf bytes.Buffer
|
var stdoutBuf bytes.Buffer
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue