Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
f3b8f4f7
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,发现更多精彩内容 >>
未验证
提交
f3b8f4f7
编写于
10月 26, 2020
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Do not use `process.env` directly in `findExecutable`
上级
56d87a3c
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
10 addition
and
6 deletion
+10
-6
src/vs/workbench/api/node/extHostTerminalService.ts
src/vs/workbench/api/node/extHostTerminalService.ts
+1
-1
src/vs/workbench/contrib/terminal/electron-browser/terminalInstanceService.ts
...trib/terminal/electron-browser/terminalInstanceService.ts
+1
-1
src/vs/workbench/contrib/terminal/node/terminalEnvironment.ts
...vs/workbench/contrib/terminal/node/terminalEnvironment.ts
+3
-3
src/vs/workbench/contrib/terminal/node/terminalProcess.ts
src/vs/workbench/contrib/terminal/node/terminalProcess.ts
+5
-1
未找到文件。
src/vs/workbench/api/node/extHostTerminalService.ts
浏览文件 @
f3b8f4f7
...
...
@@ -204,7 +204,7 @@ export class ExtHostTerminalService extends BaseExtHostTerminalService {
// TODO: When conpty is enabled, only enable it when accessibilityMode is off
const
enableConpty
=
false
;
//terminalConfig.get('windowsEnableConpty') as boolean;
const
terminalProcess
=
new
TerminalProcess
(
shellLaunchConfig
,
initialCwd
,
cols
,
rows
,
env
,
enableConpty
,
this
.
_logService
);
const
terminalProcess
=
new
TerminalProcess
(
shellLaunchConfig
,
initialCwd
,
cols
,
rows
,
env
,
process
.
env
as
platform
.
IProcessEnvironment
,
enableConpty
,
this
.
_logService
);
this
.
_setupExtHostProcessListeners
(
id
,
terminalProcess
);
const
error
=
await
terminalProcess
.
start
();
if
(
error
)
{
...
...
src/vs/workbench/contrib/terminal/electron-browser/terminalInstanceService.ts
浏览文件 @
f3b8f4f7
...
...
@@ -75,7 +75,7 @@ export class TerminalInstanceService implements ITerminalInstanceService {
}
public
createTerminalProcess
(
shellLaunchConfig
:
IShellLaunchConfig
,
cwd
:
string
,
cols
:
number
,
rows
:
number
,
env
:
IProcessEnvironment
,
windowsEnableConpty
:
boolean
):
ITerminalChildProcess
{
return
this
.
_instantiationService
.
createInstance
(
TerminalProcess
,
shellLaunchConfig
,
cwd
,
cols
,
rows
,
env
,
windowsEnableConpty
);
return
this
.
_instantiationService
.
createInstance
(
TerminalProcess
,
shellLaunchConfig
,
cwd
,
cols
,
rows
,
env
,
process
.
env
as
IProcessEnvironment
,
windowsEnableConpty
);
}
private
_isWorkspaceShellAllowed
():
boolean
{
...
...
src/vs/workbench/contrib/terminal/node/terminalEnvironment.ts
浏览文件 @
f3b8f4f7
...
...
@@ -79,7 +79,7 @@ export async function getMainProcessParentEnv(baseEnvironment: IProcessEnvironme
return
mainProcessParentEnv
!
;
}
export
async
function
findExecutable
(
command
:
string
,
cwd
?:
string
,
paths
?:
string
[]):
Promise
<
string
|
undefined
>
{
export
async
function
findExecutable
(
command
:
string
,
cwd
?:
string
,
paths
?:
string
[]
,
env
:
IProcessEnvironment
=
process
.
env
as
IProcessEnvironment
):
Promise
<
string
|
undefined
>
{
// If we have an absolute path then we take it.
if
(
path
.
isAbsolute
(
command
))
{
return
await
exists
(
command
)
?
command
:
undefined
;
...
...
@@ -94,8 +94,8 @@ export async function findExecutable(command: string, cwd?: string, paths?: stri
const
fullPath
=
path
.
join
(
cwd
,
command
);
return
await
exists
(
fullPath
)
?
fullPath
:
undefined
;
}
if
(
paths
===
undefined
&&
isString
(
process
.
env
.
PATH
))
{
paths
=
process
.
env
.
PATH
.
split
(
path
.
delimiter
);
if
(
paths
===
undefined
&&
isString
(
env
.
PATH
))
{
paths
=
env
.
PATH
.
split
(
path
.
delimiter
);
}
// No PATH environment. Make path absolute to the cwd.
if
(
paths
===
undefined
||
paths
.
length
===
0
)
{
...
...
src/vs/workbench/contrib/terminal/node/terminalProcess.ts
浏览文件 @
f3b8f4f7
...
...
@@ -57,6 +57,10 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
cols
:
number
,
rows
:
number
,
env
:
platform
.
IProcessEnvironment
,
/**
* environment used for `findExecutable`
*/
private
readonly
_executableEnv
:
platform
.
IProcessEnvironment
,
windowsEnableConpty
:
boolean
,
@
ILogService
private
readonly
_logService
:
ILogService
)
{
...
...
@@ -139,7 +143,7 @@ export class TerminalProcess extends Disposable implements ITerminalChildProcess
// The executable isn't an absolute path, try find it on the PATH or CWD
let
cwd
=
slc
.
cwd
instanceof
URI
?
slc
.
cwd
.
path
:
slc
.
cwd
!
;
const
envPaths
:
string
[]
|
undefined
=
(
slc
.
env
&&
slc
.
env
.
PATH
)
?
slc
.
env
.
PATH
.
split
(
path
.
delimiter
)
:
undefined
;
const
executable
=
await
findExecutable
(
slc
.
executable
!
,
cwd
,
envPaths
);
const
executable
=
await
findExecutable
(
slc
.
executable
!
,
cwd
,
envPaths
,
this
.
_executableEnv
);
if
(
!
executable
)
{
return
{
message
:
localize
(
'
launchFail.executableDoesNotExist
'
,
"
Path to shell executable
\"
{0}
\"
does not exist
"
,
slc
.
executable
)
};
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录