Skip to content

Commit

Permalink
bake: fix cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidGamba committed Jun 21, 2024
1 parent 3d988dc commit b930759
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions bake/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down

0 comments on commit b930759

Please sign in to comment.