fix: keep the API: postrender.NewExec and Add NewExecWithArgs

Signed-off-by: guofutan <guofutan@tencent.com>
pull/10514/head
guofutan 3 years ago
parent 46222c5c00
commit 1aab7eb3a1

@ -143,7 +143,7 @@ func (p postRendererExecFlag) Set(s string) error {
return nil
}
p.options.binaryPath = s
pr, err := postrender.NewExec(p.options.binaryPath, p.options.args)
pr, err := postrender.NewExecWithArgs(p.options.binaryPath, p.options.args)
if err != nil {
return err
}
@ -173,7 +173,7 @@ func (p postRendererArgsFlag) Set(s string) error {
return nil
}
// update if already create PostRenderer
pr, err := postrender.NewExec(p.options.binaryPath, p.options.args)
pr, err := postrender.NewExecWithArgs(p.options.binaryPath, p.options.args)
if err != nil {
return err
}

@ -34,7 +34,15 @@ type execRender struct {
// It returns an error if the binary cannot be found. If the path does not
// contain any separators, it will search in $PATH, otherwise it will resolve
// any relative paths to a fully qualified path
func NewExec(binaryPath string, args []string) (PostRenderer, error) {
func NewExec(binaryPath string) (PostRenderer, error) {
fullPath, err := getFullPath(binaryPath)
if err != nil {
return nil, err
}
return &execRender{fullPath, []string{}}, nil
}
func NewExecWithArgs(binaryPath string, args []string) (PostRenderer, error) {
fullPath, err := getFullPath(binaryPath)
if err != nil {
return nil, err

Loading…
Cancel
Save