Skip to content

Commit

Permalink
Merge pull request #40 from SoarinFerret/send-command-shell-fix
Browse files Browse the repository at this point in the history
"Send Command" shell whitespace fix
  • Loading branch information
wh1te909 authored Dec 23, 2023
2 parents f0736fa + 751b50e commit d4faa2a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,8 @@ func (a *Agent) CmdV2(c *CmdOptions) CmdStatus {
} else if c.IsExecutable {
envCmd = gocmd.NewCmdOptions(cmdOptions, c.Shell, c.Command) // c.Shell: bin + c.Command: args as one string
} 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
Expand Down

0 comments on commit d4faa2a

Please sign in to comment.