Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
811b7441
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,发现更多精彩内容 >>
提交
811b7441
编写于
4月 18, 2018
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Clean up process creation and check connected before sending
上级
414e19a5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
28 deletion
+21
-28
src/vs/workbench/api/node/extHostTerminalService.ts
src/vs/workbench/api/node/extHostTerminalService.ts
+20
-27
src/vs/workbench/parts/terminal/node/terminalProcessExtHostProxy.ts
...kbench/parts/terminal/node/terminalProcessExtHostProxy.ts
+1
-1
未找到文件。
src/vs/workbench/api/node/extHostTerminalService.ts
浏览文件 @
811b7441
...
...
@@ -6,6 +6,7 @@
import
*
as
vscode
from
'
vscode
'
;
import
*
as
cp
from
'
child_process
'
;
import
*
as
os
from
'
os
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
*
as
terminalEnvironment
from
'
vs/workbench/parts/terminal/node/terminalEnvironment
'
;
import
Uri
from
'
vs/base/common/uri
'
;
...
...
@@ -202,9 +203,12 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
}
this
.
_logService
.
info
(
'
$createProcess
'
,
id
,
shellLaunchConfig
,
cols
,
rows
);
// TODO: Base the cwd on the last active workspace root
// const lastActiveWorkspaceRootUri = this._historyService.getLastActiveWorkspaceRoot('file');
// this.initialCwd = terminalEnvironment.getCwd(shellLaunchConfig, lastActiveWorkspaceRootUri, this._configHelper);
const
initialCwd
=
os
.
homedir
();
// TODO: Pull in and resolve config settings
// // Resolve env vars from config and shell
// const lastActiveWorkspaceRoot = this._workspaceContextService.getWorkspaceFolder(lastActiveWorkspaceRootUri);
// const platformKey = platform.isWindows ? 'windows' : (platform.isMacintosh ? 'osx' : 'linux');
...
...
@@ -212,34 +216,19 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
// const envFromShell = terminalEnvironment.resolveConfigurationVariables(this._configurationResolverService, { ...shellLaunchConfig.env }, lastActiveWorkspaceRoot);
// shellLaunchConfig.env = envFromShell;
//
//
Merge process env with the env from config
//
const parentEnv = { ...process.env };
// Merge process env with the env from config
const
parentEnv
=
{
...
process
.
env
};
// terminalEnvironment.mergeEnvironments(parentEnv, envFromConfig);
// // Continue env initialization, merging in the env from the launch
// // config and adding keys that are needed to create the process
// const env = terminalEnvironment.createTerminalEnv(parentEnv, shellLaunchConfig, this.initialCwd, locale, cols, rows);
// const cwd = Uri.parse(paths.dirname(require.toUrl('../node/terminalProcess'))).fsPath;
// const options = { env, cwd };
// TODO: Launch process
// TODO: Associate the process with the terminal object/id
// TODO: terminal has incorrect name/options, fix up
const
parentEnv
=
{
...
process
.
env
};
const
env
=
terminalEnvironment
.
createTerminalEnv
(
parentEnv
,
shellLaunchConfig
,
'
/home/daniel
'
,
locale
,
cols
,
rows
);
// TODO: Use Uri?
// Continue env initialization, merging in the env from the launch
// config and adding keys that are needed to create the process
const
env
=
terminalEnvironment
.
createTerminalEnv
(
parentEnv
,
shellLaunchConfig
,
initialCwd
,
locale
,
cols
,
rows
);
let
cwd
=
Uri
.
parse
(
require
.
toUrl
(
'
../../parts/terminal/node
'
)).
fsPath
;
const
options
=
{
env
,
cwd
,
execArgv
:
[]
};
let
bootstrapUri
=
Uri
.
parse
(
require
.
toUrl
(
'
bootstrap
'
)).
fsPath
;
// Fork the process and listen for messages
this
.
_logService
.
debug
(
`Terminal process launching on ext host`
,
options
);
this
.
_terminalProcesses
[
id
]
=
cp
.
fork
(
bootstrapUri
,
[
'
--type=terminal
'
],
options
);
this
.
_terminalProcesses
[
id
]
=
cp
.
fork
(
Uri
.
parse
(
require
.
toUrl
(
'
bootstrap
'
)).
fsPath
,
[
'
--type=terminal
'
],
options
);
this
.
_terminalProcesses
[
id
].
on
(
'
message
'
,
(
message
:
IMessageFromTerminalProcess
)
=>
{
switch
(
message
.
type
)
{
case
'
pid
'
:
this
.
_proxy
.
$sendProcessPid
(
id
,
<
number
>
message
.
content
);
break
;
...
...
@@ -250,16 +239,21 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
}
public
$acceptTerminalProcessInput
(
id
:
number
,
data
:
string
):
void
{
this
.
_terminalProcesses
[
id
].
send
({
event
:
'
input
'
,
data
});
if
(
this
.
_terminalProcesses
[
id
].
connected
)
{
this
.
_terminalProcesses
[
id
].
send
({
event
:
'
input
'
,
data
});
}
}
public
$acceptTerminalProcessResize
(
id
:
number
,
cols
:
number
,
rows
:
number
):
void
{
console
.
log
(
'
resize
'
+
cols
+
'
,
'
+
rows
);
this
.
_terminalProcesses
[
id
].
send
({
event
:
'
resize
'
,
cols
,
rows
});
if
(
this
.
_terminalProcesses
[
id
].
connected
)
{
this
.
_terminalProcesses
[
id
].
send
({
event
:
'
resize
'
,
cols
,
rows
});
}
}
public
$acceptTerminalProcessShutdown
(
id
:
number
):
void
{
this
.
_terminalProcesses
[
id
].
send
({
event
:
'
shutdown
'
});
if
(
this
.
_terminalProcesses
[
id
].
connected
)
{
this
.
_terminalProcesses
[
id
].
send
({
event
:
'
shutdown
'
});
}
}
private
_getTerminalById
(
id
:
number
):
ExtHostTerminal
{
...
...
@@ -283,7 +277,6 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
}
class
ApiRequest
{
private
_callback
:
(...
args
:
any
[])
=>
void
;
private
_args
:
any
[];
...
...
src/vs/workbench/parts/terminal/node/terminalProcessExtHostProxy.ts
浏览文件 @
811b7441
...
...
@@ -9,7 +9,7 @@ import { ITerminalService, ITerminalProcessExtHostProxy, IShellLaunchConfig } fr
import
{
IDisposable
}
from
'
../../../../base/common/lifecycle
'
;
export
class
TerminalProcessExtHostProxy
extends
EventEmitter
implements
ITerminalChildProcess
,
ITerminalProcessExtHostProxy
{
//
TODO: Set this properly
//
For ext host processes connected checks happen on the ext host
public
connected
:
boolean
=
true
;
constructor
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录