Debian Codegraph @

stdlib/unrestricted/unrestricted.go

raw symbols SCIP
1 // Package unrestricted provides the original version of standard library symbols which may cause the interpreter process to exit.
2 package unrestricted
3
4 import (
5 "log"
6 "os"
7 "os/exec"
8 "reflect"
9 )
10
11 // Symbols stores the map of syscall package symbols.
12 var Symbols = map[string]map[string]reflect.Value{}
13
14 func init() {
15 Symbols["os/os"] = map[string]reflect.Value{
16 "Exit": reflect.ValueOf(os.Exit),
17 "FindProcess": reflect.ValueOf(os.FindProcess),
18 }
19
20 Symbols["os/exec/exec"] = map[string]reflect.Value{
21 "Command": reflect.ValueOf(exec.Command),
22 "CommandContext": reflect.ValueOf(exec.CommandContext),
23 "ErrNotFound": reflect.ValueOf(&exec.ErrNotFound).Elem(),
24 "LookPath": reflect.ValueOf(exec.LookPath),
25 "Cmd": reflect.ValueOf((*exec.Cmd)(nil)),
26 "Error": reflect.ValueOf((*exec.Error)(nil)),
27 "ExitError": reflect.ValueOf((*exec.ExitError)(nil)),
28 }
29
30 Symbols["log/log"] = map[string]reflect.Value{
31 "Fatal": reflect.ValueOf(log.Fatal),
32 "Fatalf": reflect.ValueOf(log.Fatalf),
33 "Fatalln": reflect.ValueOf(log.Fatalln),
34 "New": reflect.ValueOf(log.New),
35 "Logger": reflect.ValueOf((*log.Logger)(nil)),
36 }
37
38 Symbols["github.com/traefik/yaegi/stdlib/unrestricted/unrestricted"] = map[string]reflect.Value{
39 "Symbols": reflect.ValueOf(Symbols),
40 }
41 }
42
43 //go:generate ../../internal/cmd/extract/extract -include=^Exec,Exit,ForkExec,Kill,Ptrace,Reboot,Shutdown,StartProcess,Syscall syscall