Skip to content

Commit

Permalink
coredump pack: use tt env if omitted -e flag
Browse files Browse the repository at this point in the history
Closes #1069
  • Loading branch information
elhimov committed Dec 25, 2024
1 parent 337b24d commit 1788d98
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions cli/cmd/coredump.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package cmd

import (
"github.com/spf13/cobra"
"github.com/tarantool/tt/cli/cmdcontext"
"github.com/tarantool/tt/cli/coredump"
"github.com/tarantool/tt/cli/modules"
"github.com/tarantool/tt/cli/util"
)

Expand All @@ -25,15 +27,10 @@ func NewCoredumpCmd() *cobra.Command {
Use: "pack COREDUMP",
Short: "pack tarantool coredump into tar.gz archive",
Run: func(cmd *cobra.Command, args []string) {
err := coredump.Pack(args[0],
coredumpPackExecutable,
coredumpPackOutputDirectory,
coredumpPackPID,
coredumpPackTime,
)
if err != nil {
util.HandleCmdErr(cmd, err)
}
cmdCtx.CommandName = cmd.Name()
err := modules.RunCmd(&cmdCtx, cmd.CommandPath(), &modulesInfo,
internalCoredumpPackModule, args)
util.HandleCmdErr(cmd, err)
},
Args: cobra.ExactArgs(1),
}
Expand Down Expand Up @@ -80,3 +77,17 @@ func NewCoredumpCmd() *cobra.Command {

return cmd
}

// internalCoredumpPackModule is a default "pack" command for the coredump module.
func internalCoredumpPackModule(cmdCtx *cmdcontext.CmdCtx, args []string) error {
executable := coredumpPackExecutable
if coredumpPackExecutable == "" {
executable = cmdCtx.Cli.TarantoolCli.Executable
}
return coredump.Pack(args[0],
executable,
coredumpPackOutputDirectory,
coredumpPackPID,
coredumpPackTime,
)
}

0 comments on commit 1788d98

Please sign in to comment.