Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
68562163
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
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,发现更多精彩内容 >>
提交
68562163
编写于
10月 06, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
extract and reuse IProcessEnvironment
上级
6832950c
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
27 addition
and
28 deletion
+27
-28
src/vs/base/common/platform.ts
src/vs/base/common/platform.ts
+5
-1
src/vs/code/electron-main/env.ts
src/vs/code/electron-main/env.ts
+0
-4
src/vs/code/electron-main/launch.ts
src/vs/code/electron-main/launch.ts
+2
-1
src/vs/code/electron-main/main.ts
src/vs/code/electron-main/main.ts
+5
-9
src/vs/code/electron-main/window.ts
src/vs/code/electron-main/window.ts
+2
-2
src/vs/code/electron-main/windows.ts
src/vs/code/electron-main/windows.ts
+7
-7
src/vs/workbench/parts/execution/common/execution.ts
src/vs/workbench/parts/execution/common/execution.ts
+2
-1
src/vs/workbench/parts/execution/electron-browser/terminalService.ts
...bench/parts/execution/electron-browser/terminalService.ts
+4
-3
未找到文件。
src/vs/base/common/platform.ts
浏览文件 @
68562163
...
...
@@ -21,9 +21,13 @@ interface NLSConfig {
availableLanguages
:
{
[
key
:
string
]:
string
;
};
}
export
interface
IProcessEnvironment
{
[
key
:
string
]:
string
;
}
interface
INodeProcess
{
platform
:
string
;
env
:
{
[
key
:
string
]:
string
;
}
;
env
:
IProcessEnvironment
;
getuid
():
number
;
}
declare
let
process
:
INodeProcess
;
...
...
src/vs/code/electron-main/env.ts
浏览文件 @
68562163
...
...
@@ -15,10 +15,6 @@ import * as types from 'vs/base/common/types';
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
parseMainProcessArgv
,
ParsedArgs
}
from
'
vs/platform/environment/node/argv
'
;
export
interface
IProcessEnvironment
{
[
key
:
string
]:
string
;
}
export
interface
ICommandLineArguments
extends
ParsedArgs
{
paths
?:
string
[];
}
...
...
src/vs/code/electron-main/launch.ts
浏览文件 @
68562163
...
...
@@ -5,13 +5,14 @@
'
use strict
'
;
import
{
ICommandLineArguments
,
IProcessEnvironment
}
from
'
vs/code/electron-main/env
'
;
import
{
ICommandLineArguments
}
from
'
vs/code/electron-main/env
'
;
import
{
IWindowsService
}
from
'
vs/code/electron-main/windows
'
;
import
{
VSCodeWindow
}
from
'
vs/code/electron-main/window
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IChannel
}
from
'
vs/base/parts/ipc/common/ipc
'
;
import
{
ILogService
}
from
'
vs/code/electron-main/log
'
;
import
{
IURLService
}
from
'
vs/platform/url/common/url
'
;
import
{
IProcessEnvironment
}
from
'
vs/base/common/platform
'
;
export
interface
IStartArguments
{
args
:
ICommandLineArguments
;
...
...
src/vs/code/electron-main/main.ts
浏览文件 @
68562163
...
...
@@ -11,7 +11,7 @@ import { assign } from 'vs/base/common/objects';
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
{
parseMainProcessArgv
,
ParsedArgs
}
from
'
vs/platform/environment/node/argv
'
;
import
{
mkdirp
}
from
'
vs/base/node/pfs
'
;
import
{
I
ProcessEnvironment
,
I
EnvService
,
EnvService
}
from
'
vs/code/electron-main/env
'
;
import
{
IEnvService
,
EnvService
}
from
'
vs/code/electron-main/env
'
;
import
{
IWindowsService
,
WindowsManager
,
WindowEventService
}
from
'
vs/code/electron-main/windows
'
;
import
{
IWindowEventService
}
from
'
vs/code/common/windows
'
;
import
{
WindowEventChannel
}
from
'
vs/code/common/windowsIpc
'
;
...
...
@@ -69,7 +69,7 @@ function quit(accessor: ServicesAccessor, arg?: any) {
process
.
exit
(
exitCode
);
// in main, process.exit === app.exit
}
function
main
(
accessor
:
ServicesAccessor
,
mainIpcServer
:
Server
,
userEnv
:
IProcessEnvironment
):
void
{
function
main
(
accessor
:
ServicesAccessor
,
mainIpcServer
:
Server
,
userEnv
:
platform
.
IProcessEnvironment
):
void
{
const
instantiationService
=
accessor
.
get
(
IInstantiationService
);
const
logService
=
accessor
.
get
(
ILogService
);
const
envService
=
accessor
.
get
(
IEnvService
);
...
...
@@ -329,11 +329,7 @@ function setupIPC(accessor: ServicesAccessor): TPromise<Server> {
return
setup
(
true
);
}
interface
IEnv
{
[
key
:
string
]:
string
;
}
function
getUnixShellEnvironment
():
TPromise
<
IEnv
>
{
function
getUnixShellEnvironment
():
TPromise
<
platform
.
IProcessEnvironment
>
{
const
promise
=
new
TPromise
((
c
,
e
)
=>
{
const
runAsNode
=
process
.
env
[
'
ELECTRON_RUN_AS_NODE
'
];
const
noAttach
=
process
.
env
[
'
ELECTRON_NO_ATTACH_CONSOLE
'
];
...
...
@@ -396,7 +392,7 @@ function getUnixShellEnvironment(): TPromise<IEnv> {
* This should only be done when Code itself is not launched
* from within a shell.
*/
function
getShellEnvironment
():
TPromise
<
IEnv
>
{
function
getShellEnvironment
():
TPromise
<
platform
.
IProcessEnvironment
>
{
if
(
process
.
env
[
'
VSCODE_CLI
'
]
===
'
1
'
)
{
return
TPromise
.
as
({});
}
...
...
@@ -413,7 +409,7 @@ function getShellEnvironment(): TPromise<IEnv> {
* Such environment needs to be propagated to the renderer/shared
* processes.
*/
function
getEnvironment
(
accessor
:
ServicesAccessor
):
TPromise
<
IEnv
>
{
function
getEnvironment
(
accessor
:
ServicesAccessor
):
TPromise
<
platform
.
IProcessEnvironment
>
{
const
environmentService
=
accessor
.
get
(
IEnvironmentService
);
return
getShellEnvironment
().
then
(
shellEnv
=>
{
...
...
src/vs/code/electron-main/window.ts
浏览文件 @
68562163
...
...
@@ -11,7 +11,7 @@ import * as objects from 'vs/base/common/objects';
import
{
IStorageService
}
from
'
vs/code/electron-main/storage
'
;
import
{
shell
,
screen
,
BrowserWindow
}
from
'
electron
'
;
import
{
TPromise
,
TValueCallback
}
from
'
vs/base/common/winjs.base
'
;
import
{
ICommandLineArguments
,
IProcessEnvironment
}
from
'
vs/code/electron-main/env
'
;
import
{
ICommandLineArguments
}
from
'
vs/code/electron-main/env
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
ILogService
}
from
'
vs/code/electron-main/log
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
...
...
@@ -92,7 +92,7 @@ export interface IWindowConfiguration extends ICommandLineArguments {
appRoot
:
string
;
execPath
:
string
;
userEnv
:
IProcessEnvironment
;
userEnv
:
platform
.
IProcessEnvironment
;
zoomLevel
?:
number
;
...
...
src/vs/code/electron-main/windows.ts
浏览文件 @
68562163
...
...
@@ -18,7 +18,7 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
import
{
IStorageService
}
from
'
vs/code/electron-main/storage
'
;
import
{
IPath
,
VSCodeWindow
,
ReadyState
,
IWindowConfiguration
,
IWindowState
as
ISingleWindowState
,
defaultWindowState
,
IWindowSettings
}
from
'
vs/code/electron-main/window
'
;
import
{
ipcMain
as
ipc
,
app
,
screen
,
crashReporter
,
BrowserWindow
,
dialog
}
from
'
electron
'
;
import
{
ICommandLineArguments
,
I
ProcessEnvironment
,
I
EnvService
,
IParsedPath
,
parseLineAndColumnAware
}
from
'
vs/code/electron-main/env
'
;
import
{
ICommandLineArguments
,
IEnvService
,
IParsedPath
,
parseLineAndColumnAware
}
from
'
vs/code/electron-main/env
'
;
import
{
ILifecycleService
}
from
'
vs/code/electron-main/lifecycle
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IUpdateService
,
IUpdate
}
from
'
vs/code/electron-main/update-manager
'
;
...
...
@@ -41,7 +41,7 @@ enum WindowError {
export
interface
IOpenConfiguration
{
cli
:
ICommandLineArguments
;
userEnv
?:
IProcessEnvironment
;
userEnv
?:
platform
.
IProcessEnvironment
;
pathsToOpen
?:
string
[];
preferNewWindow
?:
boolean
;
forceNewWindow
?:
boolean
;
...
...
@@ -98,7 +98,7 @@ export interface IWindowsService {
onWindowFocus
:
CommonEvent
<
number
>
;
// methods
ready
(
initialUserEnv
:
IProcessEnvironment
):
void
;
ready
(
initialUserEnv
:
platform
.
IProcessEnvironment
):
void
;
reload
(
win
:
VSCodeWindow
,
cli
?:
ICommandLineArguments
):
void
;
open
(
openConfig
:
IOpenConfiguration
):
VSCodeWindow
[];
openPluginDevelopmentHostWindow
(
openConfig
:
IOpenConfiguration
):
void
;
...
...
@@ -149,7 +149,7 @@ export class WindowsManager implements IWindowsService {
private
static
WINDOWS
:
VSCodeWindow
[]
=
[];
private
eventEmitter
=
new
EventEmitter
();
private
initialUserEnv
:
IProcessEnvironment
;
private
initialUserEnv
:
platform
.
IProcessEnvironment
;
private
windowsState
:
IWindowsState
;
private
_onFocus
=
new
Emitter
<
number
>
();
...
...
@@ -187,7 +187,7 @@ export class WindowsManager implements IWindowsService {
return
()
=>
this
.
eventEmitter
.
removeListener
(
EventTypes
.
CLOSE
,
clb
);
}
public
ready
(
initialUserEnv
:
IProcessEnvironment
):
void
{
public
ready
(
initialUserEnv
:
platform
.
IProcessEnvironment
):
void
{
this
.
registerListeners
();
this
.
initialUserEnv
=
initialUserEnv
;
...
...
@@ -806,7 +806,7 @@ export class WindowsManager implements IWindowsService {
return
{
files
,
folders
};
}
private
getWindowUserEnv
(
openConfig
:
IOpenConfiguration
):
IProcessEnvironment
{
private
getWindowUserEnv
(
openConfig
:
IOpenConfiguration
):
platform
.
IProcessEnvironment
{
return
assign
({},
this
.
initialUserEnv
,
openConfig
.
userEnv
||
{});
}
...
...
@@ -843,7 +843,7 @@ export class WindowsManager implements IWindowsService {
this
.
open
({
cli
:
openConfig
.
cli
,
forceNewWindow
:
true
,
forceEmpty
:
openConfig
.
cli
.
paths
.
length
===
0
});
}
private
toConfiguration
(
userEnv
:
IProcessEnvironment
,
cli
:
ICommandLineArguments
,
workspacePath
?:
string
,
filesToOpen
?:
IPath
[],
filesToCreate
?:
IPath
[],
filesToDiff
?:
IPath
[]):
IWindowConfiguration
{
private
toConfiguration
(
userEnv
:
platform
.
IProcessEnvironment
,
cli
:
ICommandLineArguments
,
workspacePath
?:
string
,
filesToOpen
?:
IPath
[],
filesToCreate
?:
IPath
[],
filesToDiff
?:
IPath
[]):
IWindowConfiguration
{
const
configuration
:
IWindowConfiguration
=
mixin
({},
cli
);
// inherit all properties from CLI
configuration
.
appRoot
=
this
.
environmentService
.
appRoot
;
configuration
.
execPath
=
process
.
execPath
;
...
...
src/vs/workbench/parts/execution/common/execution.ts
浏览文件 @
68562163
...
...
@@ -6,11 +6,12 @@
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IProcessEnvironment
}
from
'
vs/base/common/platform
'
;
export
const
ITerminalService
=
createDecorator
<
ITerminalService
>
(
'
nativeTerminalService
'
);
export
interface
ITerminalService
{
_serviceBrand
:
any
;
openTerminal
(
path
:
string
):
void
;
runInTerminal
(
title
:
string
,
cwd
:
string
,
args
:
string
[],
env
:
{
[
key
:
string
]:
string
;
}
):
TPromise
<
void
>
;
runInTerminal
(
title
:
string
,
cwd
:
string
,
args
:
string
[],
env
:
IProcessEnvironment
):
TPromise
<
void
>
;
}
\ No newline at end of file
src/vs/workbench/parts/execution/electron-browser/terminalService.ts
浏览文件 @
68562163
...
...
@@ -14,6 +14,7 @@ import {ITerminalService} from 'vs/workbench/parts/execution/common/execution';
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ITerminalConfiguration
,
DEFAULT_TERMINAL_WINDOWS
,
DEFAULT_TERMINAL_LINUX
,
DEFAULT_TERMINAL_OSX
}
from
'
vs/workbench/parts/execution/electron-browser/terminal
'
;
import
uri
from
'
vs/base/common/uri
'
;
import
{
IProcessEnvironment
}
from
'
vs/base/common/platform
'
;
const
TERMINAL_TITLE
=
nls
.
localize
(
'
console.title
'
,
"
VS Code Console
"
);
...
...
@@ -34,7 +35,7 @@ export class WinTerminalService implements ITerminalService {
.
done
(
null
,
errors
.
onUnexpectedError
);
}
public
runInTerminal
(
title
:
string
,
dir
:
string
,
args
:
string
[],
envVars
:
{
[
key
:
string
]:
string
;
}
):
TPromise
<
void
>
{
public
runInTerminal
(
title
:
string
,
dir
:
string
,
args
:
string
[],
envVars
:
IProcessEnvironment
):
TPromise
<
void
>
{
const
configuration
=
this
.
_configurationService
.
getConfiguration
<
ITerminalConfiguration
>
();
const
terminalConfig
=
configuration
.
terminal
.
external
;
...
...
@@ -101,7 +102,7 @@ export class MacTerminalService implements ITerminalService {
this
.
spawnTerminal
(
cp
,
configuration
,
path
).
done
(
null
,
errors
.
onUnexpectedError
);
}
public
runInTerminal
(
title
:
string
,
dir
:
string
,
args
:
string
[],
envVars
:
{
[
key
:
string
]:
string
;
}
):
TPromise
<
void
>
{
public
runInTerminal
(
title
:
string
,
dir
:
string
,
args
:
string
[],
envVars
:
IProcessEnvironment
):
TPromise
<
void
>
{
const
configuration
=
this
.
_configurationService
.
getConfiguration
<
ITerminalConfiguration
>
();
const
terminalConfig
=
configuration
.
terminal
.
external
;
...
...
@@ -188,7 +189,7 @@ export class LinuxTerminalService implements ITerminalService {
.
done
(
null
,
errors
.
onUnexpectedError
);
}
public
runInTerminal
(
title
:
string
,
dir
:
string
,
args
:
string
[],
envVars
:
{
[
key
:
string
]:
string
;
}
):
TPromise
<
void
>
{
public
runInTerminal
(
title
:
string
,
dir
:
string
,
args
:
string
[],
envVars
:
IProcessEnvironment
):
TPromise
<
void
>
{
const
configuration
=
this
.
_configurationService
.
getConfiguration
<
ITerminalConfiguration
>
();
const
terminalConfig
=
configuration
.
terminal
.
external
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录