wasi-module-sdk-go/executor.go

27 lines
511 B
Go

package sdk
import (
"context"
"log/slog"
)
func NewExecutor(repoRoot, outDir, binDir string) Executor {
return Executor{
logger: slog.New(NewWASIHandler()),
repoRoot: repoRoot,
outDir: outDir,
binDir: binDir,
}
}
type Executor struct {
logger *slog.Logger
repoRoot string
outDir string
binDir string
}
func (e Executor) Run(ctx context.Context, m Module) error {
execCtx := newWasiExecutionContext(ctx, e.logger, m, e.repoRoot, e.binDir, e.outDir)
return m.Execute(execCtx)
}