Repository navigation
Description
Operating system / 操作系统
Windows
OS version and display / 系统版本与显示
Windows 11 Pro 23H2(build 22631)
Pebrel version / 版本号
2.6.0 (5ff71de)
How did you install Pebrel? / 安装方式
GitHub Release (.exe / .zip / .dmg / .AppImage / .deb)
Shell in the affected pane / 出问题的面板用的 Shell
PowerShell 7 (pwsh)
Program running in the pane / 面板里正在跑的程序
Nothing, plain shell prompt / 什么都没跑
Connection type / 连接方式
Local terminal / 本地终端
Affected area / 影响范围
Shell startup / PATH / start directory / context menu — Shell 启动、环境变量、起始目录、右键菜单
Did it work in a previous version? / 旧版本是否正常?
Not sure / 不确定
Can you reproduce it? / 复现概率
Always (100%) / 必现
Steps to reproduce / 复现步骤
- 启动 Pebrel,新开 PowerShell 7 标签页
- 执行
ls env: - 每个环境变量报一条
InvalidOperation
❯ ls env:
InvalidOperation: ...\pebrel-shell\2.6.0-9b9c4248...\pebrel_prompt.ps1:363
363 | $date = '{0,12}' -f $i.LastWriteTime.ToString('MMM d HH:mm', …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 不能对值为 Null 的表达式调用方法。
-rw-r--r-- 1 all_proxy
...
改过的设置
follow_system_theme=0、shell=pwsh、refresh_environment=1;builtin_ls 未设置,保持默认 1。
补充观察:先执行一次 pwsh 就不报错
报错来自 Pebrel 启动时注入的脚本(启动参数 -Command ". '<temp>\pebrel_prompt.ps1'"),预先手敲执行的 pwsh 子会话不加载它,ls 退回原生别名:
| 场景 | (Get-Command ls).Definition |
ls env: 错误数 |
|---|---|---|
| 加载了集成脚本的会话 | Nebula-List |
109 |
手敲 pwsh 起的子会话 |
Get-ChildItem |
0 |
父会话内先启动并退出一个 pwsh |
仍 Nebula-List |
仍 109 |
即只有"在子会话里执行"才正常。
Expected behavior / 期望结果
ls env:
Name Value
xxx yyy
Actual behavior / 实际结果
❯ ls env:
InvalidOperation: ...\pebrel-shell\2.6.0-9b9c4248...\pebrel_prompt.ps1:363
363 | $date = '{0,12}' -f $i.LastWriteTime.ToString('MMM d HH:mm', …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 不能对值为 Null 的表达式调用方法。
-rw-r--r-- 1 all_proxy
...
Logs / screenshots / 日志或截图
Non-default settings / 改过的设置
follow_system_theme=0、shell=pwsh、refresh_environment=1;builtin_ls 未设置,保持默认 1。
Before submitting / 提交前确认
- I searched existing issues and did not find a duplicate / 已搜索,无重复
- I tested with the latest release / 已用最新版本试过
- I removed passwords, private keys, tokens and other secrets / 已删除敏感信息
Activity