Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
3cdca85a
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,发现更多精彩内容 >>
提交
3cdca85a
编写于
4月 05, 2017
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
towards better quit handling (for #22138)
上级
c78e43ef
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
27 addition
and
10 deletion
+27
-10
src/vs/code/electron-main/lifecycle.ts
src/vs/code/electron-main/lifecycle.ts
+21
-4
src/vs/code/electron-main/main.ts
src/vs/code/electron-main/main.ts
+5
-5
src/vs/code/electron-main/windows.ts
src/vs/code/electron-main/windows.ts
+1
-1
未找到文件。
src/vs/code/electron-main/lifecycle.ts
浏览文件 @
3cdca85a
...
@@ -47,10 +47,15 @@ export interface ILifecycleService {
...
@@ -47,10 +47,15 @@ export interface ILifecycleService {
ready
():
void
;
ready
():
void
;
registerWindow
(
vscodeWindow
:
VSCodeWindow
):
void
;
registerWindow
(
vscodeWindow
:
VSCodeWindow
):
void
;
unload
(
vscodeWindow
:
VSCodeWindow
,
reason
:
UnloadReason
):
TPromise
<
boolean
/* veto */
>
;
unload
(
vscodeWindow
:
VSCodeWindow
,
reason
:
UnloadReason
):
TPromise
<
boolean
/* veto */
>
;
relaunch
(
options
?:
{
addArgs
?:
string
[],
removeArgs
?:
string
[]
});
quit
(
fromUpdate
?:
boolean
):
TPromise
<
boolean
/* veto */
>
;
quit
(
fromUpdate
?:
boolean
):
TPromise
<
boolean
/* veto */
>
;
relaunch
(
options
:
{
addArgs
?:
string
[],
removeArgs
?:
string
[]
});
isQuitRequested
():
boolean
;
isQuitRequested
():
boolean
;
kill
(
code
?:
number
);
}
}
export
class
LifecycleService
implements
ILifecycleService
{
export
class
LifecycleService
implements
ILifecycleService
{
...
@@ -210,6 +215,7 @@ export class LifecycleService implements ILifecycleService {
...
@@ -210,6 +215,7 @@ export class LifecycleService implements ILifecycleService {
if
(
fromUpdate
)
{
if
(
fromUpdate
)
{
this
.
storageService
.
setItem
(
LifecycleService
.
QUIT_FROM_RESTART_MARKER
,
true
);
this
.
storageService
.
setItem
(
LifecycleService
.
QUIT_FROM_RESTART_MARKER
,
true
);
}
}
this
.
pendingQuitPromiseComplete
(
false
/* no veto */
);
this
.
pendingQuitPromiseComplete
(
false
/* no veto */
);
this
.
pendingQuitPromiseComplete
=
null
;
this
.
pendingQuitPromiseComplete
=
null
;
this
.
pendingQuitPromise
=
null
;
this
.
pendingQuitPromise
=
null
;
...
@@ -223,6 +229,10 @@ export class LifecycleService implements ILifecycleService {
...
@@ -223,6 +229,10 @@ export class LifecycleService implements ILifecycleService {
return
this
.
pendingQuitPromise
;
return
this
.
pendingQuitPromise
;
}
}
public
kill
(
code
?:
number
):
void
{
app
.
exit
(
code
);
}
public
relaunch
(
options
?:
{
addArgs
?:
string
[],
removeArgs
?:
string
[]
}):
void
{
public
relaunch
(
options
?:
{
addArgs
?:
string
[],
removeArgs
?:
string
[]
}):
void
{
const
args
=
process
.
argv
.
slice
(
1
);
const
args
=
process
.
argv
.
slice
(
1
);
if
(
options
&&
options
.
addArgs
)
{
if
(
options
&&
options
.
addArgs
)
{
...
@@ -238,10 +248,17 @@ export class LifecycleService implements ILifecycleService {
...
@@ -238,10 +248,17 @@ export class LifecycleService implements ILifecycleService {
}
}
}
}
this
.
storageService
.
setItem
(
LifecycleService
.
QUIT_FROM_RESTART_MARKER
,
true
);
let
vetod
=
false
;
app
.
once
(
'
quit
'
,
()
=>
{
if
(
!
vetod
)
{
this
.
storageService
.
setItem
(
LifecycleService
.
QUIT_FROM_RESTART_MARKER
,
true
);
app
.
relaunch
({
args
});
}
});
app
.
quit
();
this
.
quit
().
then
(
veto
=>
{
app
.
once
(
'
quit
'
,
()
=>
app
.
relaunch
({
args
}));
vetod
=
veto
;
});
}
}
public
isQuitRequested
():
boolean
{
public
isQuitRequested
():
boolean
{
...
...
src/vs/code/electron-main/main.ts
浏览文件 @
3cdca85a
...
@@ -58,7 +58,6 @@ import product from 'vs/platform/node/product';
...
@@ -58,7 +58,6 @@ import product from 'vs/platform/node/product';
import
pkg
from
'
vs/platform/node/package
'
;
import
pkg
from
'
vs/platform/node/package
'
;
import
*
as
fs
from
'
original-fs
'
;
import
*
as
fs
from
'
original-fs
'
;
ipc
.
on
(
'
vscode:fetchShellEnv
'
,
(
event
,
windowId
)
=>
{
ipc
.
on
(
'
vscode:fetchShellEnv
'
,
(
event
,
windowId
)
=>
{
const
win
=
BrowserWindow
.
fromId
(
windowId
);
const
win
=
BrowserWindow
.
fromId
(
windowId
);
getShellEnvironment
().
then
(
shellEnv
=>
{
getShellEnvironment
().
then
(
shellEnv
=>
{
...
@@ -71,6 +70,7 @@ ipc.on('vscode:fetchShellEnv', (event, windowId) => {
...
@@ -71,6 +70,7 @@ ipc.on('vscode:fetchShellEnv', (event, windowId) => {
function
quit
(
accessor
:
ServicesAccessor
,
errorOrMessage
?:
Error
|
string
):
void
{
function
quit
(
accessor
:
ServicesAccessor
,
errorOrMessage
?:
Error
|
string
):
void
{
const
logService
=
accessor
.
get
(
ILogService
);
const
logService
=
accessor
.
get
(
ILogService
);
const
lifecycleService
=
accessor
.
get
(
ILifecycleService
);
let
exitCode
=
0
;
let
exitCode
=
0
;
if
(
typeof
errorOrMessage
===
'
string
'
)
{
if
(
typeof
errorOrMessage
===
'
string
'
)
{
...
@@ -84,7 +84,7 @@ function quit(accessor: ServicesAccessor, errorOrMessage?: Error | string): void
...
@@ -84,7 +84,7 @@ function quit(accessor: ServicesAccessor, errorOrMessage?: Error | string): void
}
}
}
}
process
.
exit
(
exitCode
);
// in main, process.exit === app.exit
lifecycleService
.
kill
(
exitCode
);
}
}
// TODO@Joao wow this is huge, clean up!
// TODO@Joao wow this is huge, clean up!
...
@@ -247,7 +247,7 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: platfo
...
@@ -247,7 +247,7 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: platfo
logService
.
log
(
'
IPC#vscode:exit
'
,
code
);
logService
.
log
(
'
IPC#vscode:exit
'
,
code
);
dispose
();
dispose
();
process
.
exit
(
code
);
// in main, process.exit === app.exit
lifecycleService
.
kill
(
code
);
});
});
// Lifecycle
// Lifecycle
...
@@ -397,13 +397,13 @@ function start(): void {
...
@@ -397,13 +397,13 @@ function start(): void {
args
=
validatePaths
(
args
);
args
=
validatePaths
(
args
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
err
.
message
);
console
.
error
(
err
.
message
);
process
.
exit
(
1
);
app
.
exit
(
1
);
return
;
return
;
}
}
const
instantiationService
=
createServices
(
args
);
const
instantiationService
=
createServices
(
args
);
return
instantiationService
.
invokeFunction
(
accessor
=>
{
return
instantiationService
.
invokeFunction
(
accessor
=>
{
const
environmentService
=
accessor
.
get
(
IEnvironmentService
);
const
environmentService
=
accessor
.
get
(
IEnvironmentService
);
const
instanceEnv
:
typeof
process
.
env
=
{
const
instanceEnv
:
typeof
process
.
env
=
{
...
...
src/vs/code/electron-main/windows.ts
浏览文件 @
3cdca85a
...
@@ -1318,7 +1318,7 @@ export class WindowsManager implements IWindowsMainService {
...
@@ -1318,7 +1318,7 @@ export class WindowsManager implements IWindowsMainService {
// Otherwise: normal quit
// Otherwise: normal quit
else
{
else
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
app
.
quit
();
this
.
lifecycleService
.
quit
();
},
10
/* delay to unwind callback stack (IPC) */
);
},
10
/* delay to unwind callback stack (IPC) */
);
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录