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

Add a Test-Path around the line which auto-imports modules into runspaces #1296

Closed
Badgerati opened this issue May 11, 2024 · 1 comment · Fixed by #1300
Closed

Add a Test-Path around the line which auto-imports modules into runspaces #1296

Badgerati opened this issue May 11, 2024 · 1 comment · Fixed by #1300
Assignees
Labels
Milestone

Comments

@Badgerati
Copy link
Owner

Describe the Bug

When you have modules like Oh-My-Posh (OMP) installed, and you have Pode's auto-module importing enabled, you can run into issues because OMP will generate randomly name internal modules which don't actually exist. When Pode tries to import one of these, it fails and crashes out the starting of any runspaces.

Primarily, here:

function Import-PodeModules {
# import other modules in the session
foreach ($path in $PodeContext.Server.Modules.Values) {
$null = Import-Module $path -DisableNameChecking -Scope Global -ErrorAction Stop
}
}

Steps To Reproduce

  1. Have Pode's auto-module importing enabled
  2. Have OMP installed, and imported
  3. Attempt to start any Pode server

Expected Behavior

The server should start successfully.

Platform

  • OS: Windows
  • Browser: N/A
  • Versions:
    • Pode: 2.10.0
    • PowerShell: 7.4.2
@Badgerati Badgerati added this to the 2.10.1 milestone May 11, 2024
@Badgerati Badgerati self-assigned this May 11, 2024
Badgerati added a commit that referenced this issue May 12, 2024
@Badgerati
Copy link
Owner Author

The commit above also includes a fix for a stack overflow issue when converting $using: scoped variables, which was commonly seen when using Pode 2.10.0 with Pode.Web 0.8.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
1 participant