Skip to content

Commit

Permalink
added shell command input to commands prepending shell
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisz100 committed Apr 28, 2018
1 parent fb605ed commit bccc664
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
9 changes: 7 additions & 2 deletions pkg/commands/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,13 @@ func (c *CmdCommand) ExecuteCommand(config *v1.Config) error {
var newCommand []string
if c.cmd.PrependShell {
// This is the default shell on Linux
// TODO: Support shell command here
shell := []string{"/bin/sh", "-c"}
var shell []string
if len(config.Shell) > 0 {
shell = config.Shell
} else {
shell = append(shell, "/bin/sh", "-c")
}

newCommand = append(shell, strings.Join(c.cmd.CmdLine, " "))
} else {
newCommand = c.cmd.CmdLine
Expand Down
9 changes: 7 additions & 2 deletions pkg/commands/entrypoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@ func (e *EntrypointCommand) ExecuteCommand(config *v1.Config) error {
var newCommand []string
if e.cmd.PrependShell {
// This is the default shell on Linux
// TODO: Support shell command here
shell := []string{"/bin/sh", "-c"}
var shell []string
if len(config.Shell) > 0 {
shell = config.Shell
} else {
shell = append(shell, "/bin/sh", "-c")
}

newCommand = append(shell, strings.Join(e.cmd.CmdLine, " "))
} else {
newCommand = e.cmd.CmdLine
Expand Down
9 changes: 7 additions & 2 deletions pkg/commands/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ func (r *RunCommand) ExecuteCommand(config *v1.Config) error {
var newCommand []string
if r.cmd.PrependShell {
// This is the default shell on Linux
// TODO: Support shell command here
shell := []string{"/bin/sh", "-c"}
var shell []string
if len(config.Shell) > 0 {
shell = config.Shell
} else {
shell = append(shell, "/bin/sh", "-c")
}

newCommand = append(shell, strings.Join(r.cmd.CmdLine, " "))
} else {
newCommand = r.cmd.CmdLine
Expand Down

0 comments on commit bccc664

Please sign in to comment.