Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
68b2f0f8
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,发现更多精彩内容 >>
提交
68b2f0f8
编写于
10月 01, 2018
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove TPromise usage in execution part
Part of #53526
上级
61ae1599
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
20 addition
and
23 deletion
+20
-23
src/vs/workbench/parts/execution/common/execution.ts
src/vs/workbench/parts/execution/common/execution.ts
+1
-2
src/vs/workbench/parts/execution/electron-browser/terminal.ts
...vs/workbench/parts/execution/electron-browser/terminal.ts
+4
-5
src/vs/workbench/parts/execution/electron-browser/terminalService.ts
...bench/parts/execution/electron-browser/terminalService.ts
+15
-16
未找到文件。
src/vs/workbench/parts/execution/common/execution.ts
浏览文件 @
68b2f0f8
...
...
@@ -5,7 +5,6 @@
'
use strict
'
;
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
'
);
...
...
@@ -13,5 +12,5 @@ export const ITerminalService = createDecorator<ITerminalService>('nativeTermina
export
interface
ITerminalService
{
_serviceBrand
:
any
;
openTerminal
(
path
:
string
):
void
;
runInTerminal
(
title
:
string
,
cwd
:
string
,
args
:
string
[],
env
:
IProcessEnvironment
):
T
Promise
<
void
>
;
runInTerminal
(
title
:
string
,
cwd
:
string
,
args
:
string
[],
env
:
IProcessEnvironment
):
Promise
<
void
>
;
}
\ No newline at end of file
src/vs/workbench/parts/execution/electron-browser/terminal.ts
浏览文件 @
68b2f0f8
...
...
@@ -6,14 +6,13 @@
import
*
as
env
from
'
vs/base/common/platform
'
;
import
*
as
pfs
from
'
vs/base/node/pfs
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
let
_DEFAULT_TERMINAL_LINUX_READY
:
T
Promise
<
string
>
=
null
;
export
function
getDefaultTerminalLinuxReady
():
T
Promise
<
string
>
{
let
_DEFAULT_TERMINAL_LINUX_READY
:
Promise
<
string
>
=
null
;
export
function
getDefaultTerminalLinuxReady
():
Promise
<
string
>
{
if
(
!
_DEFAULT_TERMINAL_LINUX_READY
)
{
_DEFAULT_TERMINAL_LINUX_READY
=
new
T
Promise
<
string
>
(
c
=>
{
_DEFAULT_TERMINAL_LINUX_READY
=
new
Promise
<
string
>
(
c
=>
{
if
(
env
.
isLinux
)
{
TPromise
.
join
([
pfs
.
exists
(
'
/etc/debian_version
'
),
process
.
lazyEnv
]).
then
(([
isDebian
])
=>
{
Promise
.
all
([
pfs
.
exists
(
'
/etc/debian_version
'
),
process
.
lazyEnv
]).
then
(([
isDebian
])
=>
{
if
(
isDebian
)
{
c
(
'
x-terminal-emulator
'
);
}
else
if
(
process
.
env
.
DESKTOP_SESSION
===
'
gnome
'
||
process
.
env
.
DESKTOP_SESSION
===
'
gnome-classic
'
)
{
...
...
src/vs/workbench/parts/execution/electron-browser/terminalService.ts
浏览文件 @
68b2f0f8
...
...
@@ -10,7 +10,6 @@ import * as path from 'path';
import
*
as
processes
from
'
vs/base/node/processes
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
ITerminalService
}
from
'
vs/workbench/parts/execution/common/execution
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ITerminalConfiguration
,
getDefaultTerminalWindows
,
getDefaultTerminalLinuxReady
,
DEFAULT_TERMINAL_OSX
}
from
'
vs/workbench/parts/execution/electron-browser/terminal
'
;
...
...
@@ -40,13 +39,13 @@ export class WinTerminalService implements ITerminalService {
this
.
spawnTerminal
(
cp
,
configuration
,
processes
.
getWindowsShell
(),
cwd
);
}
public
runInTerminal
(
title
:
string
,
dir
:
string
,
args
:
string
[],
envVars
:
IProcessEnvironment
):
T
Promise
<
void
>
{
public
runInTerminal
(
title
:
string
,
dir
:
string
,
args
:
string
[],
envVars
:
IProcessEnvironment
):
Promise
<
void
>
{
const
configuration
=
this
.
_configurationService
.
getValue
<
ITerminalConfiguration
>
();
const
terminalConfig
=
configuration
.
terminal
.
external
;
const
exec
=
terminalConfig
.
windowsExec
||
getDefaultTerminalWindows
();
return
new
T
Promise
<
void
>
((
c
,
e
)
=>
{
return
new
Promise
<
void
>
((
c
,
e
)
=>
{
const
title
=
`"
${
dir
}
-
${
TERMINAL_TITLE
}
"`
;
const
command
=
`""
${
args
.
join
(
'
" "
'
)}
" & pause"`
;
// use '|' to only pause on non-zero exit code
...
...
@@ -74,7 +73,7 @@ export class WinTerminalService implements ITerminalService {
});
}
private
spawnTerminal
(
spawner
,
configuration
:
ITerminalConfiguration
,
command
:
string
,
cwd
?:
string
):
T
Promise
<
void
>
{
private
spawnTerminal
(
spawner
,
configuration
:
ITerminalConfiguration
,
command
:
string
,
cwd
?:
string
):
Promise
<
void
>
{
const
terminalConfig
=
configuration
.
terminal
.
external
;
const
exec
=
terminalConfig
.
windowsExec
||
getDefaultTerminalWindows
();
const
spawnType
=
this
.
getSpawnType
(
exec
);
...
...
@@ -88,14 +87,14 @@ export class WinTerminalService implements ITerminalService {
// unless otherwise specified
if
(
spawnType
===
WinSpawnType
.
CMDER
)
{
spawner
.
spawn
(
exec
,
[
cwd
]);
return
TPromise
.
as
(
void
0
);
return
Promise
.
resolve
(
void
0
);
}
// The '""' argument is the window title. Without this, exec doesn't work when the path
// contains spaces
const
cmdArgs
=
[
'
/c
'
,
'
start
'
,
'
/wait
'
,
'
""
'
,
exec
];
return
new
T
Promise
<
void
>
((
c
,
e
)
=>
{
return
new
Promise
<
void
>
((
c
,
e
)
=>
{
const
env
=
cwd
?
{
cwd
:
cwd
}
:
void
0
;
const
child
=
spawner
.
spawn
(
command
,
cmdArgs
,
env
);
child
.
on
(
'
error
'
,
e
);
...
...
@@ -127,13 +126,13 @@ export class MacTerminalService implements ITerminalService {
this
.
spawnTerminal
(
cp
,
configuration
,
cwd
);
}
public
runInTerminal
(
title
:
string
,
dir
:
string
,
args
:
string
[],
envVars
:
IProcessEnvironment
):
T
Promise
<
void
>
{
public
runInTerminal
(
title
:
string
,
dir
:
string
,
args
:
string
[],
envVars
:
IProcessEnvironment
):
Promise
<
void
>
{
const
configuration
=
this
.
_configurationService
.
getValue
<
ITerminalConfiguration
>
();
const
terminalConfig
=
configuration
.
terminal
.
external
;
const
terminalApp
=
terminalConfig
.
osxExec
||
DEFAULT_TERMINAL_OSX
;
return
new
T
Promise
<
void
>
((
c
,
e
)
=>
{
return
new
Promise
<
void
>
((
c
,
e
)
=>
{
if
(
terminalApp
===
DEFAULT_TERMINAL_OSX
||
terminalApp
===
'
iTerm.app
'
)
{
...
...
@@ -191,11 +190,11 @@ export class MacTerminalService implements ITerminalService {
});
}
private
spawnTerminal
(
spawner
,
configuration
:
ITerminalConfiguration
,
cwd
?:
string
):
T
Promise
<
void
>
{
private
spawnTerminal
(
spawner
,
configuration
:
ITerminalConfiguration
,
cwd
?:
string
):
Promise
<
void
>
{
const
terminalConfig
=
configuration
.
terminal
.
external
;
const
terminalApp
=
terminalConfig
.
osxExec
||
DEFAULT_TERMINAL_OSX
;
return
new
T
Promise
<
void
>
((
c
,
e
)
=>
{
return
new
Promise
<
void
>
((
c
,
e
)
=>
{
const
child
=
spawner
.
spawn
(
'
/usr/bin/open
'
,
[
'
-a
'
,
terminalApp
,
cwd
]);
child
.
on
(
'
error
'
,
e
);
child
.
on
(
'
exit
'
,
()
=>
c
(
null
));
...
...
@@ -219,13 +218,13 @@ export class LinuxTerminalService implements ITerminalService {
this
.
spawnTerminal
(
cp
,
configuration
,
cwd
);
}
public
runInTerminal
(
title
:
string
,
dir
:
string
,
args
:
string
[],
envVars
:
IProcessEnvironment
):
T
Promise
<
void
>
{
public
runInTerminal
(
title
:
string
,
dir
:
string
,
args
:
string
[],
envVars
:
IProcessEnvironment
):
Promise
<
void
>
{
const
configuration
=
this
.
_configurationService
.
getValue
<
ITerminalConfiguration
>
();
const
terminalConfig
=
configuration
.
terminal
.
external
;
const
execPromise
=
terminalConfig
.
linuxExec
?
TPromise
.
as
(
terminalConfig
.
linuxExec
)
:
getDefaultTerminalLinuxReady
();
const
execPromise
=
terminalConfig
.
linuxExec
?
Promise
.
resolve
(
terminalConfig
.
linuxExec
)
:
getDefaultTerminalLinuxReady
();
return
new
T
Promise
<
void
>
((
c
,
e
)
=>
{
return
new
Promise
<
void
>
((
c
,
e
)
=>
{
let
termArgs
:
string
[]
=
[];
//termArgs.push('--title');
...
...
@@ -275,12 +274,12 @@ export class LinuxTerminalService implements ITerminalService {
});
}
private
spawnTerminal
(
spawner
,
configuration
:
ITerminalConfiguration
,
cwd
?:
string
):
T
Promise
<
void
>
{
private
spawnTerminal
(
spawner
,
configuration
:
ITerminalConfiguration
,
cwd
?:
string
):
Promise
<
void
>
{
const
terminalConfig
=
configuration
.
terminal
.
external
;
const
execPromise
=
terminalConfig
.
linuxExec
?
TPromise
.
as
(
terminalConfig
.
linuxExec
)
:
getDefaultTerminalLinuxReady
();
const
execPromise
=
terminalConfig
.
linuxExec
?
Promise
.
resolve
(
terminalConfig
.
linuxExec
)
:
getDefaultTerminalLinuxReady
();
const
env
=
cwd
?
{
cwd
:
cwd
}
:
void
0
;
return
new
T
Promise
<
void
>
((
c
,
e
)
=>
{
return
new
Promise
<
void
>
((
c
,
e
)
=>
{
execPromise
.
then
(
exec
=>
{
const
child
=
spawner
.
spawn
(
exec
,
[],
env
);
child
.
on
(
'
error
'
,
e
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录