Skip to content

Commit

Permalink
🐛 Fix exec not logging command
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Jul 14, 2022
1 parent 141135e commit 5c0b2a0
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions cmd/exec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ func run(cmd *cobra.Command, args []string) (err error) {
sizeQueue = t.MonitorSize(t.GetSize())
}

podCmd := buildCommand(conf.Dialect, conf, args)
return t.Safe(func() error {
return conf.Client.Exec(
conf.Pod,
buildCommand(conf.Dialect, conf, args).String(),
podCmd.String(),
t.In,
t.Out,
os.Stderr,
Expand All @@ -55,14 +56,14 @@ func run(cmd *cobra.Command, args []string) (err error) {
})
}

func buildCommand(db config.Databaser, conf config.Exec, args []string) *command.Builder {
func buildCommand(db config.Databaser, conf config.Exec, args []string) (cmd *command.Builder) {
if len(args) == 0 {
return db.ExecCommand(conf)
}

cmd := command.NewBuilder("exec")
for _, arg := range args {
cmd.Push(arg)
cmd = db.ExecCommand(conf)
} else {
cmd = command.NewBuilder("exec")
for _, arg := range args {
cmd.Push(arg)
}
}
log.WithField("cmd", cmd).Trace("finished building command")
return cmd
Expand Down

0 comments on commit 5c0b2a0

Please sign in to comment.