Documentation
¶
Index ¶
- Constants
- Variables
- func RunLocalModule(args RunLocalModuleArgs) (scriptResult core.Value, scriptState *core.GlobalState, ...)
- func RunPreparedModule(args RunPreparedModuleArgs) (moduleResult core.Value, moduleState *core.GlobalState, module *core.Module, ...)
- type RunLocalModuleArgs
- type RunPreparedModuleArgs
Constants ¶
View Source
const (
DEFAULT_MAX_ALLOWED_WARNINGS = 10
)
Variables ¶
View Source
var ( ErrExecutionAbortedTooManyWarnings = errors.New("execution was aborted because there are too many warnings") ErrUserRefusedExecution = errors.New("user refused execution") ErrNoProvidedConfirmExecPrompt = errors.New("risk score too high and no provided way to show confirm prompt") )
Functions ¶
func RunLocalModule ¶
func RunLocalModule(args RunLocalModuleArgs) ( scriptResult core.Value, scriptState *core.GlobalState, scriptModule *core.Module, preparationSuccess bool, _err error, )
RunLocalModule runs a module located in the filesystem.
func RunPreparedModule ¶
func RunPreparedModule(args RunPreparedModuleArgs) ( moduleResult core.Value, moduleState *core.GlobalState, module *core.Module, preparationSuccess bool, _err error, )
RunPreparedModule runs a prepared module with the configuration specified in RunPreparedModuleArgs (e.g. .UseBytecode).
Types ¶
type RunLocalModuleArgs ¶
type RunLocalModuleArgs struct {
Fpath string
PassedCLIArgs []string
PassedArgs *core.ModuleArgs
ParsingCompilationContext *core.Context
ParentContext *core.Context
ParentContextRequired bool //make .ParentContext required
StdlibCtx context.Context //should not be set if ParentContext is set
AdditionalPermissions []core.Permission //should not be set if ParentContext is set
//used during the preinit
PreinitFilesystem afs.Filesystem
//If nil the parent context's filesystem is used.
//If there is no parent context the OS filesystem is used.
ScriptContextFileSystem afs.Filesystem
FullAccessToDatabases bool
Project *project.Project
UseBytecode bool
OptimizeBytecode bool
ShowBytecode bool
AllowMissingEnvVars bool
IgnoreHighRiskScore bool
EnableTesting bool
TestFilters core.TestFilters
//if not nil AND UseBytecode is false the script is executed in debug mode with this debugger.
//Debugger.AttachAndStart is called before starting the evaluation.
//if nil the parent state's debugger is used if present.
Debugger *core.Debugger
//output for execution, if nil os.Stdout is used
Out io.Writer
//ignored if .Logger is set
LogOut io.Writer
Logger zerolog.Logger
LogLevels *core.LogLevels
//PreparedChan signals when the script is prepared (nil error) or failed to be prepared (non-nil error),
//the channel should be buffered.
PreparedChan chan error
OnPrepared func(state *core.GlobalState) error
}
type RunPreparedModuleArgs ¶
type RunPreparedModuleArgs struct {
State *core.GlobalState
ParsingCompilationContext *core.Context
ParentContext *core.Context
//do not show the confirmation prompt to the user if the risk score is high.
IgnoreHighRiskScore bool
UseBytecode bool
OptimizeBytecode bool
ShowBytecode bool
DoNotCancelWhenFinished bool
Debugger *core.Debugger
}
Click to show internal directories.
Click to hide internal directories.