Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
2ecae80a
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2ecae80a
编写于
4月 05, 2014
作者:
A
Alex Crichton
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix some windows rpass tests
上级
0d9fd8e2
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
72 addition
and
30 deletion
+72
-30
src/libnative/io/process.rs
src/libnative/io/process.rs
+55
-26
src/test/auxiliary/lang-item-public.rs
src/test/auxiliary/lang-item-public.rs
+1
-1
src/test/run-pass/issue-9047.rs
src/test/run-pass/issue-9047.rs
+3
-1
src/test/run-pass/lang-item-public.rs
src/test/run-pass/lang-item-public.rs
+2
-1
src/test/run-pass/tcp-stress.rs
src/test/run-pass/tcp-stress.rs
+11
-1
未找到文件。
src/libnative/io/process.rs
浏览文件 @
2ecae80a
...
@@ -40,6 +40,9 @@ pub struct Process {
...
@@ -40,6 +40,9 @@ pub struct Process {
/// None until finish() is called.
/// None until finish() is called.
exit_code
:
Option
<
p
::
ProcessExit
>
,
exit_code
:
Option
<
p
::
ProcessExit
>
,
/// Manually delivered signal
exit_signal
:
Option
<
int
>
,
}
}
impl
Process
{
impl
Process
{
...
@@ -107,7 +110,12 @@ fn get_io(io: p::StdioContainer, ret: &mut ~[Option<file::FileDesc>])
...
@@ -107,7 +110,12 @@ fn get_io(io: p::StdioContainer, ret: &mut ~[Option<file::FileDesc>])
match
res
{
match
res
{
Ok
(
res
)
=>
{
Ok
(
res
)
=>
{
Ok
((
Process
{
pid
:
res
.pid
,
handle
:
res
.handle
,
exit_code
:
None
},
Ok
((
Process
{
pid
:
res
.pid
,
handle
:
res
.handle
,
exit_code
:
None
,
exit_signal
:
None
,
},
ret_io
))
ret_io
))
}
}
Err
(
e
)
=>
Err
(
e
)
Err
(
e
)
=>
Err
(
e
)
...
@@ -127,6 +135,14 @@ fn wait(&mut self) -> p::ProcessExit {
...
@@ -127,6 +135,14 @@ fn wait(&mut self) -> p::ProcessExit {
Some
(
code
)
=>
code
,
Some
(
code
)
=>
code
,
None
=>
{
None
=>
{
let
code
=
waitpid
(
self
.pid
);
let
code
=
waitpid
(
self
.pid
);
// On windows, waitpid will never return a signal. If a signal
// was successfully delivered to the process, however, we can
// consider it as having died via a signal.
let
code
=
match
self
.exit_signal
{
None
=>
code
,
Some
(
signal
)
if
cfg!
(
windows
)
=>
p
::
ExitSignal
(
signal
),
Some
(
..
)
=>
code
,
};
self
.exit_code
=
Some
(
code
);
self
.exit_code
=
Some
(
code
);
code
code
}
}
...
@@ -157,7 +173,14 @@ fn kill(&mut self, signum: int) -> Result<(), io::IoError> {
...
@@ -157,7 +173,14 @@ fn kill(&mut self, signum: int) -> Result<(), io::IoError> {
}),
}),
None
=>
{}
None
=>
{}
}
}
return
unsafe
{
killpid
(
self
.pid
,
signum
)
};
// A successfully delivered signal that isn't 0 (just a poll for being
// alive) is recorded for windows (see wait())
match
unsafe
{
killpid
(
self
.pid
,
signum
)
}
{
Ok
(())
if
signum
==
0
=>
Ok
(()),
Ok
(())
=>
{
self
.exit_signal
=
Some
(
signum
);
Ok
(())
}
Err
(
e
)
=>
Err
(
e
),
}
}
}
}
}
...
@@ -256,31 +279,37 @@ fn spawn_process_os(config: p::ProcessConfig,
...
@@ -256,31 +279,37 @@ fn spawn_process_os(config: p::ProcessConfig,
let
cur_proc
=
GetCurrentProcess
();
let
cur_proc
=
GetCurrentProcess
();
let
orig_std_in
=
get_osfhandle
(
in_fd
)
as
HANDLE
;
if
in_fd
!=
-
1
{
if
orig_std_in
==
INVALID_HANDLE_VALUE
as
HANDLE
{
let
orig_std_in
=
get_osfhandle
(
in_fd
)
as
HANDLE
;
fail
!
(
"failure in get_osfhandle: {}"
,
os
::
last_os_error
());
if
orig_std_in
==
INVALID_HANDLE_VALUE
as
HANDLE
{
}
fail
!
(
"failure in get_osfhandle: {}"
,
os
::
last_os_error
());
if
DuplicateHandle
(
cur_proc
,
orig_std_in
,
cur_proc
,
&
mut
si
.hStdInput
,
}
0
,
TRUE
,
DUPLICATE_SAME_ACCESS
)
==
FALSE
{
if
DuplicateHandle
(
cur_proc
,
orig_std_in
,
cur_proc
,
&
mut
si
.hStdInput
,
fail
!
(
"failure in DuplicateHandle: {}"
,
os
::
last_os_error
());
0
,
TRUE
,
DUPLICATE_SAME_ACCESS
)
==
FALSE
{
fail
!
(
"failure in DuplicateHandle: {}"
,
os
::
last_os_error
());
}
}
}
let
orig_std_out
=
get_osfhandle
(
out_fd
)
as
HANDLE
;
if
out_fd
!=
-
1
{
if
orig_std_out
==
INVALID_HANDLE_VALUE
as
HANDLE
{
let
orig_std_out
=
get_osfhandle
(
out_fd
)
as
HANDLE
;
fail
!
(
"failure in get_osfhandle: {}"
,
os
::
last_os_error
());
if
orig_std_out
==
INVALID_HANDLE_VALUE
as
HANDLE
{
}
fail
!
(
"failure in get_osfhandle: {}"
,
os
::
last_os_error
());
if
DuplicateHandle
(
cur_proc
,
orig_std_out
,
cur_proc
,
&
mut
si
.hStdOutput
,
}
0
,
TRUE
,
DUPLICATE_SAME_ACCESS
)
==
FALSE
{
if
DuplicateHandle
(
cur_proc
,
orig_std_out
,
cur_proc
,
&
mut
si
.hStdOutput
,
fail
!
(
"failure in DuplicateHandle: {}"
,
os
::
last_os_error
());
0
,
TRUE
,
DUPLICATE_SAME_ACCESS
)
==
FALSE
{
fail
!
(
"failure in DuplicateHandle: {}"
,
os
::
last_os_error
());
}
}
}
let
orig_std_err
=
get_osfhandle
(
err_fd
)
as
HANDLE
;
if
err_fd
!=
-
1
{
if
orig_std_err
==
INVALID_HANDLE_VALUE
as
HANDLE
{
let
orig_std_err
=
get_osfhandle
(
err_fd
)
as
HANDLE
;
fail
!
(
"failure in get_osfhandle: {}"
,
os
::
last_os_error
());
if
orig_std_err
==
INVALID_HANDLE_VALUE
as
HANDLE
{
}
fail
!
(
"failure in get_osfhandle: {}"
,
os
::
last_os_error
());
if
DuplicateHandle
(
cur_proc
,
orig_std_err
,
cur_proc
,
&
mut
si
.hStdError
,
}
0
,
TRUE
,
DUPLICATE_SAME_ACCESS
)
==
FALSE
{
if
DuplicateHandle
(
cur_proc
,
orig_std_err
,
cur_proc
,
&
mut
si
.hStdError
,
fail
!
(
"failure in DuplicateHandle: {}"
,
os
::
last_os_error
());
0
,
TRUE
,
DUPLICATE_SAME_ACCESS
)
==
FALSE
{
fail
!
(
"failure in DuplicateHandle: {}"
,
os
::
last_os_error
());
}
}
}
let
cmd
=
make_command_line
(
config
.program
,
config
.args
);
let
cmd
=
make_command_line
(
config
.program
,
config
.args
);
...
@@ -307,9 +336,9 @@ fn spawn_process_os(config: p::ProcessConfig,
...
@@ -307,9 +336,9 @@ fn spawn_process_os(config: p::ProcessConfig,
})
})
});
});
assert
!
(
CloseHandle
(
si
.hStdInput
)
!=
0
);
if
in_fd
!=
-
1
{
assert
!
(
CloseHandle
(
si
.hStdInput
)
!=
0
);
}
assert
!
(
CloseHandle
(
si
.hStdOutput
)
!=
0
);
if
out_fd
!=
-
1
{
assert
!
(
CloseHandle
(
si
.hStdOutput
)
!=
0
);
}
assert
!
(
CloseHandle
(
si
.hStdError
)
!=
0
);
if
err_fd
!=
-
1
{
assert
!
(
CloseHandle
(
si
.hStdError
)
!=
0
);
}
match
create_err
{
match
create_err
{
Some
(
err
)
=>
return
Err
(
err
),
Some
(
err
)
=>
return
Err
(
err
),
...
...
src/test/auxiliary/lang-item-public.rs
浏览文件 @
2ecae80a
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// except according to those terms.
#
[no_std]
;
#
![no_std]
#[lang=
"fail_"
]
#[lang=
"fail_"
]
fn
fail
(
_
:
*
i8
,
_
:
*
i8
,
_
:
uint
)
->
!
{
loop
{}
}
fn
fail
(
_
:
*
i8
,
_
:
*
i8
,
_
:
uint
)
->
!
{
loop
{}
}
...
...
src/test/run-pass/issue-9047.rs
浏览文件 @
2ecae80a
...
@@ -16,4 +16,6 @@ fn decode() -> ~str {
...
@@ -16,4 +16,6 @@ fn decode() -> ~str {
~
""
~
""
}
}
pub
fn
main
()
{}
pub
fn
main
()
{
println!
(
"{}"
,
decode
());
}
src/test/run-pass/lang-item-public.rs
浏览文件 @
2ecae80a
...
@@ -10,8 +10,9 @@
...
@@ -10,8 +10,9 @@
// aux-build:lang-item-public.rs
// aux-build:lang-item-public.rs
// ignore-android
// ignore-android
// ignore-win32 #13361
#
[no_std]
;
#
![no_std]
extern
crate
lang_lib
=
"lang-item-public"
;
extern
crate
lang_lib
=
"lang-item-public"
;
...
...
src/test/run-pass/tcp-stress.rs
浏览文件 @
2ecae80a
...
@@ -16,10 +16,18 @@
...
@@ -16,10 +16,18 @@
#[phase(syntax,
link)]
#[phase(syntax,
link)]
extern
crate
log
;
extern
crate
log
;
extern
crate
libc
;
extern
crate
libc
;
extern
crate
green
;
extern
crate
rustuv
;
use
std
::
io
::
net
::
ip
::{
Ipv4Addr
,
SocketAddr
};
use
std
::
io
::
net
::
ip
::{
Ipv4Addr
,
SocketAddr
};
use
std
::
io
::
net
::
tcp
::{
TcpListener
,
TcpStream
};
use
std
::
io
::
net
::
tcp
::{
TcpListener
,
TcpStream
};
use
std
::
io
::{
Acceptor
,
Listener
};
use
std
::
io
::{
Acceptor
,
Listener
};
use
std
::
task
;
#[start]
fn
start
(
argc
:
int
,
argv
:
**
u8
)
->
int
{
green
::
start
(
argc
,
argv
,
rustuv
::
event_loop
,
main
)
}
fn
main
()
{
fn
main
()
{
// This test has a chance to time out, try to not let it time out
// This test has a chance to time out, try to not let it time out
...
@@ -53,7 +61,9 @@ fn main() {
...
@@ -53,7 +61,9 @@ fn main() {
let
(
tx
,
rx
)
=
channel
();
let
(
tx
,
rx
)
=
channel
();
for
_
in
range
(
0
,
1000
)
{
for
_
in
range
(
0
,
1000
)
{
let
tx
=
tx
.clone
();
let
tx
=
tx
.clone
();
spawn
(
proc
()
{
let
mut
builder
=
task
::
task
();
builder
.opts.stack_size
=
Some
(
32
*
1024
);
builder
.spawn
(
proc
()
{
match
TcpStream
::
connect
(
addr
)
{
match
TcpStream
::
connect
(
addr
)
{
Ok
(
stream
)
=>
{
Ok
(
stream
)
=>
{
let
mut
stream
=
stream
;
let
mut
stream
=
stream
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录