Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
2d892ae9
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
2d892ae9
编写于
1月 13, 2021
作者:
T
Tyler James Leonhardt
提交者:
GitHub
1月 13, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix arch check for PowerShell enumeration (#114292)
上级
3ca55d03
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
11 addition
and
12 deletion
+11
-12
src/vs/base/node/powershell.ts
src/vs/base/node/powershell.ts
+1
-1
src/vs/base/test/node/powershell.test.ts
src/vs/base/test/node/powershell.test.ts
+10
-11
未找到文件。
src/vs/base/node/powershell.ts
浏览文件 @
2d892ae9
...
...
@@ -19,7 +19,7 @@ const PwshPreviewMsixRegex: RegExp = /^Microsoft.PowerShellPreview_.*/;
// The platform details descriptor for the platform we're on
const
isProcess64Bit
:
boolean
=
process
.
arch
===
'
x64
'
;
const
isOS64Bit
:
boolean
=
isProcess64Bit
||
env
.
hasOwnProperty
(
'
PROCESSOR_ARCHITEW6432
'
)
;
const
isOS64Bit
:
boolean
=
isProcess64Bit
||
os
.
arch
()
===
'
x64
'
;
export
interface
IPowerShellExeDetails
{
readonly
displayName
:
string
;
...
...
src/vs/base/test/node/powershell.test.ts
浏览文件 @
2d892ae9
...
...
@@ -39,16 +39,15 @@ if (platform.isWindows) {
checkPath
(
exePath
!
);
});
test
.
skip
(
'
Can enumerate PowerShells
'
,
async
()
=>
{
// https://github.com/microsoft/vscode/issues/114248
test
(
'
Can enumerate PowerShells
'
,
async
()
=>
{
const
isOS64Bit
=
os
.
arch
()
===
'
x64
'
;
const
pwshs
=
new
Array
<
IPowerShellExeDetails
>
();
for
await
(
const
p
of
enumeratePowerShellInstallations
())
{
pwshs
.
push
(
p
);
}
// In Azure DevOps and GitHub Actions there should be an extra PowerShell since PowerShell 7 comes pre-installed
const
minNumberOfPowerShells
=
process
.
env
.
TF_BUILD
||
process
.
env
.
CI
?
3
:
2
;
assert
.
strictEqual
(
pwshs
.
length
>=
minNumberOfPowerShells
,
true
,
'
Found these PowerShells:
\n
'
+
pwshs
.
map
(
p
=>
`
${
p
.
displayName
}
:
${
p
.
exePath
}
`
).
join
(
'
\n
'
));
const
powershellLog
=
'
Found these PowerShells:
\n
'
+
pwshs
.
map
(
p
=>
`
${
p
.
displayName
}
:
${
p
.
exePath
}
`
).
join
(
'
\n
'
);
assert
.
strictEqual
(
pwshs
.
length
>=
(
isOS64Bit
?
2
:
1
),
true
,
powershellLog
);
for
(
const
pwsh
of
pwshs
)
{
checkPath
(
pwsh
.
exePath
);
...
...
@@ -61,23 +60,23 @@ if (platform.isWindows) {
// 64bit process on 64bit OS
if
(
process
.
arch
===
'
x64
'
)
{
checkPath
(
pwshs
[
secondToLastIndex
].
exePath
);
assert
.
strictEqual
(
pwshs
[
secondToLastIndex
].
displayName
,
'
Windows PowerShell
'
);
assert
.
strictEqual
(
pwshs
[
secondToLastIndex
].
displayName
,
'
Windows PowerShell
'
,
powershellLog
);
checkPath
(
pwshs
[
lastIndex
].
exePath
);
assert
.
strictEqual
(
pwshs
[
lastIndex
].
displayName
,
'
Windows PowerShell (x86)
'
);
}
else
if
(
os
.
arch
()
===
'
x64
'
)
{
assert
.
strictEqual
(
pwshs
[
lastIndex
].
displayName
,
'
Windows PowerShell (x86)
'
,
powershellLog
);
}
else
if
(
isOS64Bit
)
{
// 32bit process on 64bit OS
// Windows PowerShell x86 comes first if vscode is 32bit
checkPath
(
pwshs
[
secondToLastIndex
].
exePath
);
assert
.
strictEqual
(
pwshs
[
secondToLastIndex
].
displayName
,
'
Windows PowerShell (x86)
'
);
assert
.
strictEqual
(
pwshs
[
secondToLastIndex
].
displayName
,
'
Windows PowerShell (x86)
'
,
powershellLog
);
checkPath
(
pwshs
[
lastIndex
].
exePath
);
assert
.
strictEqual
(
pwshs
[
lastIndex
].
displayName
,
'
Windows PowerShell
'
);
assert
.
strictEqual
(
pwshs
[
lastIndex
].
displayName
,
'
Windows PowerShell
'
,
powershellLog
);
}
else
{
// 32bit or ARM process
checkPath
(
pwshs
[
lastIndex
].
exePath
);
assert
.
strictEqual
(
pwshs
[
lastIndex
].
displayName
,
'
Windows PowerShell (x86)
'
);
assert
.
strictEqual
(
pwshs
[
lastIndex
].
displayName
,
'
Windows PowerShell (x86)
'
,
powershellLog
);
}
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录