diff --git a/bake/tree.go b/bake/tree.go index c65161a..94ccfb1 100644 --- a/bake/tree.go +++ b/bake/tree.go @@ -80,9 +80,14 @@ func (ot *OptTree) AddCommand(name, descName, description string) (*getoptions.G if len(keys) == i+1 { node.Children[key].Name = name cmd.SetCommandFn(func(ctx context.Context, opt *getoptions.GetOpt, args []string) error { - // TODO: Run os.exec call to the built binary with keys as the arguments Logger.Printf("Running %v from %s\n", InputArgs, Dir) - c := []string{filepath.Join(Dir, "./bake")} + // filepath.Join removes the ./ if Dir is . + // Need to ensure that it is running the local binary, not the one in the PATH + cmd := "./bake" + if Dir != "." { + cmd = filepath.Join(Dir, "bake") + } + c := []string{cmd} run.CMD(append(c, InputArgs...)...).Log().Run() return nil })