winpsenv

package
v0.30.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package winpsenv prepares the environment for Windows PowerShell child processes.

When sailwright is started from PowerShell 7 (pwsh), for example from the default shell of GitHub Actions Windows runners, child processes inherit pwsh's PSModulePath. Windows PowerShell 5.1 then loads incompatible PowerShell 7 core modules: Microsoft.PowerShell.Security fails to load and the Cert: drive is missing, among other breakage. pwsh applies a similar mitigation (removing its own module paths) when it starts powershell.exe directly; this package does the same for processes sailwright starts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommandEnv

func CommandEnv(executable string, extraEnv []string) []string

CommandEnv returns the environment for a child process started with executable, or nil to inherit the current environment unchanged. extraEnv is appended last so it overrides inherited values.

func IsWindowsPowerShell

func IsWindowsPowerShell(executable string) bool

IsWindowsPowerShell reports whether executable names Windows PowerShell (powershell or powershell.exe, optionally with a directory), as opposed to PowerShell 7 (pwsh).

func Sanitize

func Sanitize(executable string, environ []string) ([]string, []string)

Sanitize returns environ with PowerShell 7 module directories removed from PSModulePath when executable is Windows PowerShell, plus the removed entries. For any other executable, or when nothing is removed, environ is returned unchanged. If PSModulePath only held PowerShell 7 entries, the variable is dropped so Windows PowerShell computes its default.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL