1
0
Fork 0

Support syscall

This commit is contained in:
David 2025-10-17 17:46:05 +02:00 committed by GitHub
parent 05de0670ea
commit d1ab6ed489
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 247 additions and 8 deletions

View file

@ -16,6 +16,7 @@ import (
"github.com/traefik/traefik/v3/pkg/observability/logs"
"github.com/traefik/yaegi/interp"
"github.com/traefik/yaegi/stdlib"
"github.com/traefik/yaegi/stdlib/syscall"
"github.com/traefik/yaegi/stdlib/unsafe"
)
@ -135,7 +136,7 @@ func newInterpreter(ctx context.Context, goPath string, manifest *Manifest, sett
}
if manifest.UseUnsafe && !settings.UseUnsafe {
return nil, errors.New("this plugin uses unsafe import. If you want to use it, you need to allow useUnsafe in the settings")
return nil, errors.New("this plugin uses restricted imports. If you want to use it, you need to allow useUnsafe in the settings")
}
if settings.UseUnsafe && manifest.UseUnsafe {
@ -143,6 +144,11 @@ func newInterpreter(ctx context.Context, goPath string, manifest *Manifest, sett
if err != nil {
return nil, fmt.Errorf("failed to load unsafe symbols: %w", err)
}
err = i.Use(syscall.Symbols)
if err != nil {
return nil, fmt.Errorf("failed to load syscall symbols: %w", err)
}
}
err = i.Use(ppSymbols())