This commit is contained in:
Maxim Slipenko 2025-02-12 14:50:45 +03:00
parent 90867f5d7c
commit ed173867f5
3 changed files with 7 additions and 7 deletions

@ -164,7 +164,10 @@ func (d *Decoder) DecodeVars(val any) error {
return nil
}
type ScriptFunc func(ctx context.Context, opts ...interp.RunnerOption) error
type (
ScriptFunc func(ctx context.Context, opts ...interp.RunnerOption) error
ScriptFuncWithSubshell func(ctx context.Context, opts ...interp.RunnerOption) (*interp.Runner, error)
)
// GetFunc returns a function corresponding to a bash function
// with the given name
@ -197,10 +200,7 @@ func (d *Decoder) GetFuncP(name string, prepare PrepareFunc) (ScriptFunc, bool)
}, true
}
// TODO: replace
func (d *Decoder) GetFuncSub(name string) (
func(ctx context.Context, opts ...interp.RunnerOption) (*interp.Runner, error), bool,
) {
func (d *Decoder) GetFuncWithSubshell(name string) (ScriptFuncWithSubshell, bool) {
fn := d.getFunc(name)
if fn == nil {
return nil, false

@ -351,7 +351,7 @@ func (b *Builder) executeFirstPass(
for _, pkgName := range b.opts.Packages {
var preVars types.BuildVarsPre
funcName := fmt.Sprintf("meta_%s", pkgName)
meta, ok := dec.GetFuncSub(funcName)
meta, ok := dec.GetFuncWithSubshell(funcName)
if !ok {
return "", nil, errors.New("func is missing")
}

@ -223,7 +223,7 @@ func (rs *Repos) updatePkg(ctx context.Context, repo types.Repo, runner *interp.
if err != nil {
return err
}
meta, ok := d.GetFuncSub(funcName)
meta, ok := d.GetFuncWithSubshell(funcName)
if !ok {
return errors.New("func is missing")
}