Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
87f50658
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
87f50658
编写于
4月 13, 2018
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move processReady over
上级
e505941d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
18 addition
and
16 deletion
+18
-16
src/vs/workbench/parts/terminal/common/terminal.ts
src/vs/workbench/parts/terminal/common/terminal.ts
+1
-0
src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts
...bench/parts/terminal/electron-browser/terminalInstance.ts
+13
-13
src/vs/workbench/parts/terminal/electron-browser/terminalProcessManager.ts
...parts/terminal/electron-browser/terminalProcessManager.ts
+4
-3
未找到文件。
src/vs/workbench/parts/terminal/common/terminal.ts
浏览文件 @
87f50658
...
...
@@ -461,6 +461,7 @@ export interface ITerminalProcessManager extends IDisposable {
// TODO: Strongly type me
process
:
any
;
processState
:
ProcessState
;
ptyProcessReady
:
TPromise
<
void
>
;
addDisposable
(
disposable
:
IDisposable
);
}
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts
浏览文件 @
87f50658
...
...
@@ -79,7 +79,7 @@ export class TerminalInstance implements ITerminalInstance {
private
_hadFocusOnExit
:
boolean
;
private
_isVisible
:
boolean
;
// private _processState: ProcessState;
private
_processReady
:
TPromise
<
void
>
;
//
private _processReady: TPromise<void>;
private
_isDisposed
:
boolean
;
private
readonly
_onDisposed
:
Emitter
<
ITerminalInstance
>
;
private
readonly
_onFocused
:
Emitter
<
ITerminalInstance
>
;
...
...
@@ -113,7 +113,7 @@ export class TerminalInstance implements ITerminalInstance {
public
get
id
():
number
{
return
this
.
_id
;
}
// TODO: Ideally processId would be merged into processReady
public
get
processId
():
number
{
return
this
.
_processId
;
}
public
get
processReady
():
TPromise
<
void
>
{
return
this
.
_processReady
;
}
public
get
processReady
():
TPromise
<
void
>
{
return
this
.
_process
Manager
.
ptyProcess
Ready
;
}
public
get
onDisposed
():
Event
<
ITerminalInstance
>
{
return
this
.
_onDisposed
.
event
;
}
public
get
onFocused
():
Event
<
ITerminalInstance
>
{
return
this
.
_onFocused
.
event
;
}
public
get
onProcessIdReady
():
Event
<
ITerminalInstance
>
{
return
this
.
_onProcessIdReady
.
event
;
}
...
...
@@ -161,21 +161,13 @@ export class TerminalInstance implements ITerminalInstance {
this
.
_onProcessIdReady
=
new
Emitter
<
TerminalInstance
>
();
this
.
_onTitleChanged
=
new
Emitter
<
string
>
();
// Create a promise that resolves when the pty is ready
this
.
_processReady
=
new
TPromise
<
void
>
(
c
=>
{
this
.
onProcessIdReady
(()
=>
{
this
.
_logService
.
debug
(
`Terminal process ready (id:
${
this
.
id
}
, processId:
${
this
.
processId
}
)`
);
c
(
void
0
);
});
});
this
.
_initDimensions
();
this
.
_createProcess
();
this
.
_xtermReadyPromise
=
this
.
_createXterm
();
this
.
_xtermReadyPromise
.
then
(()
=>
{
if
(
platform
.
isWindows
)
{
this
.
_processReady
.
then
(()
=>
{
this
.
_process
Manager
.
ptyProcess
Ready
.
then
(()
=>
{
if
(
!
this
.
_isDisposed
)
{
this
.
_windowsShellHelper
=
new
WindowsShellHelper
(
this
.
_processId
,
this
,
this
.
_xterm
);
}
...
...
@@ -584,7 +576,7 @@ export class TerminalInstance implements ITerminalInstance {
}
public
sendText
(
text
:
string
,
addNewLine
:
boolean
):
void
{
this
.
_processReady
.
then
(()
=>
{
this
.
_process
Manager
.
ptyProcess
Ready
.
then
(()
=>
{
// Normalize line endings to 'enter' press.
text
=
text
.
replace
(
TerminalInstance
.
EOL_REGEX
,
'
\r
'
);
if
(
addNewLine
&&
text
.
substr
(
text
.
length
-
1
)
!==
'
\r
'
)
{
...
...
@@ -688,6 +680,14 @@ export class TerminalInstance implements ITerminalInstance {
// TODO: This should be injected in to the terminal instance (from service?)
this
.
_processManager
=
new
TerminalProcessManager
();
// Create a promise that resolves when the pty is ready
this
.
_processManager
.
ptyProcessReady
=
new
TPromise
<
void
>
(
c
=>
{
this
.
onProcessIdReady
(()
=>
{
this
.
_logService
.
debug
(
`Terminal process ready (id:
${
this
.
id
}
, processId:
${
this
.
processId
}
)`
);
c
(
void
0
);
});
});
const
locale
=
this
.
_configHelper
.
config
.
setLocaleVariables
?
platform
.
locale
:
undefined
;
if
(
!
this
.
_shellLaunchConfig
.
executable
)
{
this
.
_configHelper
.
mergeDefaultShellPathAndArgs
(
this
.
_shellLaunchConfig
);
...
...
@@ -1161,7 +1161,7 @@ export class TerminalInstance implements ITerminalInstance {
}
}
this
.
_processReady
.
then
(()
=>
{
this
.
_process
Manager
.
ptyProcess
Ready
.
then
(()
=>
{
if
(
this
.
_processManager
.
process
&&
this
.
_processManager
.
process
.
connected
)
{
// The child process could aready be terminated
try
{
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalProcessManager.ts
浏览文件 @
87f50658
...
...
@@ -6,20 +6,21 @@
import
{
ChildProcess
}
from
'
child_process
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
ProcessState
,
ITerminalProcessManager
}
from
'
vs/workbench/parts/terminal/common/terminal
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
/**
* Holds all state related to the creation and management of terminal processes.
*
* Definitions:
* - Process: The process launched with the terminalProcess.ts file
* - Pty Process: The pseudoterminal
slave
process (or the winpty agent process)
* - Shell Process: The pseudoterminal
master process
* - Pty Process: The pseudoterminal
master
process (or the winpty agent process)
* - Shell Process: The pseudoterminal
slave process (ie. the shell)
*/
export
class
TerminalProcessManager
implements
ITerminalProcessManager
{
public
processState
:
ProcessState
=
ProcessState
.
UNINITIALIZED
;
// _process
public
process
:
ChildProcess
;
// private _terminal
ProcessReady: TPromise<void>;
public
pty
ProcessReady
:
TPromise
<
void
>
;
// private _shellProcessId: number;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录