Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
4252e67b
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,发现更多精彩内容 >>
提交
4252e67b
编写于
10月 26, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix one part of #60192
上级
1ac04b53
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
74 addition
and
33 deletion
+74
-33
src/vs/code/electron-main/main.ts
src/vs/code/electron-main/main.ts
+45
-18
src/vs/code/node/cli.ts
src/vs/code/node/cli.ts
+3
-15
src/vs/code/node/wait.ts
src/vs/code/node/wait.ts
+26
-0
未找到文件。
src/vs/code/electron-main/main.ts
浏览文件 @
4252e67b
...
...
@@ -49,6 +49,7 @@ import { setUnexpectedErrorHandler } from 'vs/base/common/errors';
import
{
IDialogService
}
from
'
vs/platform/dialogs/common/dialogs
'
;
import
{
CommandLineDialogService
}
from
'
vs/platform/dialogs/node/dialogService
'
;
import
{
ILabelService
,
LabelService
}
from
'
vs/platform/label/common/label
'
;
import
{
createWaitMarkerFile
}
from
'
vs/code/node/wait
'
;
function
createServices
(
args
:
ParsedArgs
,
bufferLogService
:
BufferLogService
):
IInstantiationService
{
const
services
=
new
ServiceCollection
();
...
...
@@ -293,23 +294,7 @@ function quit(accessor: ServicesAccessor, reason?: ExpectedError | Error): void
lifecycleService
.
kill
(
exitCode
);
}
function
main
()
{
// Set the error handler early enough so that we are not getting the
// default electron error dialog popping up
setUnexpectedErrorHandler
(
err
=>
console
.
error
(
err
));
let
args
:
ParsedArgs
;
try
{
args
=
parseMainProcessArgv
(
process
.
argv
);
args
=
validatePaths
(
args
);
}
catch
(
err
)
{
console
.
error
(
err
.
message
);
app
.
exit
(
1
);
return
void
0
;
}
function
startup
(
args
:
ParsedArgs
):
void
{
// We need to buffer the spdlog logs until we are sure
// we are the only instance running, otherwise we'll have concurrent
// log file access on Windows
...
...
@@ -317,7 +302,7 @@ function main() {
const
bufferLogService
=
new
BufferLogService
();
const
instantiationService
=
createServices
(
args
,
bufferLogService
);
return
instantiationService
.
invokeFunction
(
accessor
=>
{
instantiationService
.
invokeFunction
(
accessor
=>
{
// Patch `process.env` with the instance's environment
const
environmentService
=
accessor
.
get
(
IEnvironmentService
);
...
...
@@ -343,4 +328,46 @@ function main() {
}).
then
(
null
,
err
=>
instantiationService
.
invokeFunction
(
quit
,
err
));
}
function
main
():
void
{
// Set the error handler early enough so that we are not getting the
// default electron error dialog popping up
setUnexpectedErrorHandler
(
err
=>
console
.
error
(
err
));
// Parse arguments
let
args
:
ParsedArgs
;
try
{
args
=
parseMainProcessArgv
(
process
.
argv
);
args
=
validatePaths
(
args
);
}
catch
(
err
)
{
console
.
error
(
err
.
message
);
app
.
exit
(
1
);
return
void
0
;
}
// If we are started with --wait create a random temporary file
// and pass it over to the starting instance. We can use this file
// to wait for it to be deleted to monitor that the edited file
// is closed and then exit the waiting process.
//
// Note: we are not doing this if the wait marker has been already
// added as argument. This can happen if Code was started from CLI.
if
(
args
.
wait
&&
!
args
.
waitMarkerFilePath
)
{
createWaitMarkerFile
(
args
.
verbose
).
then
(
waitMarkerFilePath
=>
{
if
(
waitMarkerFilePath
)
{
process
.
argv
.
push
(
'
--waitMarkerFilePath
'
,
waitMarkerFilePath
);
args
.
waitMarkerFilePath
=
waitMarkerFilePath
;
}
startup
(
args
);
});
}
// Otherwise just startup normally
else
{
startup
(
args
);
}
}
main
();
src/vs/code/node/cli.ts
浏览文件 @
4252e67b
...
...
@@ -20,6 +20,7 @@ import * as iconv from 'iconv-lite';
import
{
writeFileAndFlushSync
}
from
'
vs/base/node/extfs
'
;
import
{
isWindows
}
from
'
vs/base/common/platform
'
;
import
{
ProfilingSession
}
from
'
v8-inspect-profiler
'
;
import
{
createWaitMarkerFile
}
from
'
vs/code/node/wait
'
;
function
shouldSpawnCliProcess
(
argv
:
ParsedArgs
):
boolean
{
return
!!
argv
[
'
install-source
'
]
...
...
@@ -228,22 +229,9 @@ export async function main(argv: string[]): Promise<any> {
// is closed and then exit the waiting process.
let
waitMarkerFilePath
:
string
;
if
(
args
.
wait
)
{
let
waitMarkerError
:
Error
;
const
randomTmpFile
=
paths
.
join
(
os
.
tmpdir
(),
Math
.
random
().
toString
(
36
).
replace
(
/
[^
a-z
]
+/g
,
''
).
substr
(
0
,
10
));
try
{
fs
.
writeFileSync
(
randomTmpFile
,
''
);
waitMarkerFilePath
=
randomTmpFile
;
waitMarkerFilePath
=
await
createWaitMarkerFile
(
verbose
);
if
(
waitMarkerFilePath
)
{
argv
.
push
(
'
--waitMarkerFilePath
'
,
waitMarkerFilePath
);
}
catch
(
error
)
{
waitMarkerError
=
error
;
}
if
(
verbose
)
{
if
(
waitMarkerError
)
{
console
.
error
(
`Failed to create marker file for --wait:
${
waitMarkerError
.
toString
()}
`
);
}
else
{
console
.
log
(
`Marker file for --wait created:
${
waitMarkerFilePath
}
`
);
}
}
}
...
...
src/vs/code/node/wait.ts
0 → 100644
浏览文件 @
4252e67b
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
join
}
from
'
path
'
;
import
{
tmpdir
}
from
'
os
'
;
import
{
writeFile
}
from
'
vs/base/node/pfs
'
;
export
function
createWaitMarkerFile
(
verbose
?:
boolean
):
Promise
<
string
>
{
const
randomWaitMarkerPath
=
join
(
tmpdir
(),
Math
.
random
().
toString
(
36
).
replace
(
/
[^
a-z
]
+/g
,
''
).
substr
(
0
,
10
));
return
writeFile
(
randomWaitMarkerPath
,
''
).
then
(()
=>
{
if
(
verbose
)
{
console
.
log
(
`Marker file for --wait created:
${
randomWaitMarkerPath
}
`
);
}
return
randomWaitMarkerPath
;
},
error
=>
{
if
(
verbose
)
{
console
.
error
(
`Failed to create marker file for --wait:
${
error
}
`
);
}
return
Promise
.
resolve
(
void
0
);
});
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录