Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$PSScriptRoot is null when loading scripts into Resolve-DynamicFunctionDefinition via dot sourcing #6

Open
thayesgh opened this issue Nov 8, 2024 · 0 comments

Comments

@thayesgh
Copy link

thayesgh commented Nov 8, 2024

General summary of the issue

  • $PSScriptRoot is null when loading scripts into Resolve-DynamicFunctionDefinition via dot sourcing

Describe your environment

  • Dynamic version : 1.1.1
    PowerShell version : 7.4.0
    OS version : Microsoft Windows NT 10.0.19045.0

Steps to reproduce

    invokeOnImport  = {
            $public = Get-ChildItem -Path "$PSScriptRoot/public" -Filter *.ps1

            foreach ($script in $public) {
                . $script.FullName

                $functionInfo = Get-Command -Name $script.BaseName

                . (Resolve-DynamicFunctionDefinition -FunctionInfo $functionInfo)
            }
        }

Expected Behavior

  • $PSScriptRoot is set to the appropriate path of the script/function being called.

Current Behavior

  • $PSScriptRoot is null.

Possible Solution? (optional)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant