func doRuntimeBootstrap()

in lambda/rapid/handlers.go [190:219]


func doRuntimeBootstrap(execCtx *rapidContext, sbInfoFromInit interop.SandboxInfoFromInit) ([]string, map[string]string, string, []*os.File, error) {
	env := sbInfoFromInit.EnvironmentVariables
	runtimeBootstrap := sbInfoFromInit.RuntimeBootstrap
	bootstrapCmd, err := runtimeBootstrap.Cmd()
	if err != nil {
		if fatalError, formattedLog, hasError := runtimeBootstrap.CachedFatalError(err); hasError {
			appctx.StoreFirstFatalError(execCtx.appCtx, fatalError)
			execCtx.eventsAPI.SendImageErrorLog(interop.ImageErrorLogData(formattedLog))
		} else {
			appctx.StoreFirstFatalError(execCtx.appCtx, fatalerror.InvalidEntrypoint)
		}
		return []string{}, map[string]string{}, "", []*os.File{}, err
	}

	bootstrapEnv := runtimeBootstrap.Env(env)
	bootstrapCwd, err := runtimeBootstrap.Cwd()
	if err != nil {
		if fatalError, formattedLog, hasError := runtimeBootstrap.CachedFatalError(err); hasError {
			appctx.StoreFirstFatalError(execCtx.appCtx, fatalError)
			execCtx.eventsAPI.SendImageErrorLog(interop.ImageErrorLogData(formattedLog))
		} else {
			appctx.StoreFirstFatalError(execCtx.appCtx, fatalerror.InvalidWorkingDir)
		}
		return []string{}, map[string]string{}, "", []*os.File{}, err
	}

	bootstrapExtraFiles := runtimeBootstrap.ExtraFiles()

	return bootstrapCmd, bootstrapEnv, bootstrapCwd, bootstrapExtraFiles, nil
}