You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`multi-pwsh host <selector> ...` runs PowerShell through native hosting (`pwsh-host` crate) instead of launching a `pwsh` subprocess.
105
111
-`<selector>` supports `7`, `7.4`, `7.4.13`, or alias-form selectors such as `pwsh-7.4`.
112
+
-`-VirtualEnvironment <name>` and `-venv <name>` are consumed by `multi-pwsh` before handing control to PowerShell and set `PSModulePath` to the selected venv root for that launch.
106
113
- Alias lifecycle now maintains native host shims as hard links to `multi-pwsh` automatically during install/update/doctor alias repair.
107
114
- On Windows, host shims are `pwsh-*.exe` files alongside `.cmd` wrappers in `MULTI_PWSH_BIN_DIR` (default: `~/.pwsh/bin`).
108
115
- On Linux/macOS, alias command paths (`pwsh-*`) are hard links to `multi-pwsh`.
109
116
-`multi-pwsh doctor --repair-aliases` performs a shim health check and re-links broken hard links automatically.
110
117
- You can still manually copy/rename `multi-pwsh.exe` under `MULTI_PWSH_BIN_DIR` (default: `~/.pwsh/bin`) to an alias-like name (for example `pwsh-7.4.exe`); it automatically enters host mode and resolves the target installation from that alias name.
111
118
-`-NamedPipeCommand <pipeName>` is supported in host mode (Windows only), matching `pwsh-host` behavior.
112
119
120
+
### Virtual environments
121
+
122
+
`multi-pwsh` virtual environments provide isolated PowerShell module roots. They are conceptually similar to Python virtual environments, but in this first version the isolation is implemented by selecting a venv-specific `PSModulePath` root for hosted launches.
123
+
124
+
By default, venvs live under `~/.pwsh/venv/<name>`. If `MULTI_PWSH_VENV_DIR` is set, they live under that directory instead.
125
+
126
+
Available commands:
127
+
128
+
-`multi-pwsh venv create <name>` creates a named venv.
129
+
-`multi-pwsh venv delete <name>` removes a named venv.
130
+
-`multi-pwsh venv export <name> <archive.zip>` exports a named venv to a zip archive.
131
+
-`multi-pwsh venv import <name> <archive.zip>` imports a named venv from a zip archive.
132
+
-`multi-pwsh venv list` shows the configured venv root and all known venvs.
133
+
134
+
#### Create and use a venv
135
+
136
+
Create a venv and launch a hosted PowerShell session that uses it:
Import is intentionally conservative: importing into an existing destination venv is rejected instead of merging archive contents.
180
+
181
+
#### Current behavior and limitations
182
+
183
+
- Venv selection changes module discovery and import precedence for hosted launches.
184
+
- In this first version, `Install-Module` is not automatically redirected into the venv just because `-venv` is used.
185
+
- PowerShell may still include some built-in or default module paths in the effective `PSModulePath`; the venv is intended to be the selected module root, not a perfect process-level sandbox.
186
+
- The venv feature currently applies to `multi-pwsh host ...` and implicit host shims such as `pwsh-7.4.exe`, not to arbitrary external `pwsh` processes.
187
+
113
188
Managed paths can be controlled with environment variables:
114
189
115
-
-`MULTI_PWSH_HOME`: override the multi-pwsh home directory (default: `~/.pwsh`). Extracted PowerShell versions are stored under `MULTI_PWSH_HOME/multi`, and alias metadata is stored in `MULTI_PWSH_HOME/aliases.json`.
190
+
-`MULTI_PWSH_HOME`: override the multi-pwsh home directory (default: `~/.pwsh`). Extracted PowerShell versions are stored under `MULTI_PWSH_HOME/multi`, virtual environments are stored under `MULTI_PWSH_HOME/venv` unless `MULTI_PWSH_VENV_DIR` is set, and alias metadata is stored in `MULTI_PWSH_HOME/aliases.json`.
116
191
-`MULTI_PWSH_BIN_DIR`: override the shim and launcher directory (default: `MULTI_PWSH_HOME/bin`).
0 commit comments