Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
7a1dc76b
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,发现更多精彩内容 >>
提交
7a1dc76b
编写于
4月 19, 2012
作者:
B
Brian Anderson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
core: Move set_exit_status from sys to os
上级
1cad6322
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
16 addition
and
17 deletion
+16
-17
src/libcore/os.rs
src/libcore/os.rs
+13
-0
src/libcore/sys.rs
src/libcore/sys.rs
+0
-14
src/test/run-fail/rt-set-exit-status-fail.rs
src/test/run-fail/rt-set-exit-status-fail.rs
+1
-1
src/test/run-fail/rt-set-exit-status-fail2.rs
src/test/run-fail/rt-set-exit-status-fail2.rs
+1
-1
src/test/run-fail/rt-set-exit-status.rs
src/test/run-fail/rt-set-exit-status.rs
+1
-1
未找到文件。
src/libcore/os.rs
浏览文件 @
7a1dc76b
...
...
@@ -33,6 +33,7 @@
make_absolute
,
make_dir
,
remove_dir
,
change_dir
,
remove_file
,
copy_file
;
export
last_os_error
;
export
set_exit_status
;
// FIXME: move these to str perhaps?
export
as_c_charp
,
fill_charp_buf
;
...
...
@@ -45,6 +46,7 @@
fn
rust_list_files
(
path
:
str
)
->
[
str
];
fn
rust_process_wait
(
handle
:
c_int
)
->
c_int
;
fn
last_os_error
()
->
str
;
fn
rust_set_exit_status
(
code
:
libc
::
intptr_t
);
}
...
...
@@ -630,6 +632,17 @@ fn last_os_error() -> str {
rustrt
::
last_os_error
()
}
#[doc
=
"
Sets the process exit code
Sets the exit code returned by the process if all supervised tasks terminate
successfully (without failing). If the current root task fails and is
supervised by the scheduler then any user-specified exit status is ignored and
the process exits with the default failure status
"
]
fn
set_exit_status
(
code
:
int
)
{
rustrt
::
rust_set_exit_status
(
code
as
libc
::
intptr_t
);
}
#[cfg(target_os
=
"macos"
)]
mod
consts
{
...
...
src/libcore/sys.rs
浏览文件 @
7a1dc76b
...
...
@@ -6,7 +6,6 @@
export
align_of
;
export
refcount
;
export
log_str
;
export
set_exit_status
;
enum
type_desc
=
{
first_param
:
**
libc
::
c_int
,
...
...
@@ -20,7 +19,6 @@ enum type_desc = {
fn
refcount
<
T
>
(
t
:
@
T
)
->
libc
::
intptr_t
;
fn
unsupervise
();
fn
shape_log_str
<
T
>
(
t
:
*
sys
::
type_desc
,
data
:
T
)
->
str
;
fn
rust_set_exit_status
(
code
:
libc
::
intptr_t
);
}
#[abi
=
"rust-intrinsic"
]
...
...
@@ -59,18 +57,6 @@ fn log_str<T>(t: T) -> str {
rustrt
::
shape_log_str
(
get_type_desc
::
<
T
>
(),
t
)
}
#[doc
=
"
Sets the process exit code
Sets the exit code returned by the process if all supervised tasks terminate
successfully (without failing). If the current root task fails and is
supervised by the scheduler then any user-specified exit status is ignored and
the process exits with the default failure status
"
]
fn
set_exit_status
(
code
:
int
)
{
rustrt
::
rust_set_exit_status
(
code
as
libc
::
intptr_t
);
}
#[cfg(test)]
mod
tests
{
...
...
src/test/run-fail/rt-set-exit-status-fail.rs
浏览文件 @
7a1dc76b
...
...
@@ -5,6 +5,6 @@ fn main() {
// Setting the exit status only works when the scheduler terminates
// normally. In this case we're going to fail, so instead of of
// returning 50 the process will return the typical rt failure code.
sy
s
::
set_exit_status
(
50
);
o
s
::
set_exit_status
(
50
);
fail
;
}
\ No newline at end of file
src/test/run-fail/rt-set-exit-status-fail2.rs
浏览文件 @
7a1dc76b
...
...
@@ -7,7 +7,7 @@ fn main() {
// Setting the exit status after the runtime has already
// failed has no effect and the process exits with the
// runtime's exit code
sy
s
::
set_exit_status
(
50
);
o
s
::
set_exit_status
(
50
);
}
let
i
=
r
(());
};
...
...
src/test/run-fail/rt-set-exit-status.rs
浏览文件 @
7a1dc76b
...
...
@@ -4,5 +4,5 @@ fn main() {
log
(
error
,
"whatever"
);
// 101 is the code the runtime uses on task failure and the value
// compiletest expects run-fail tests to return.
sy
s
::
set_exit_status
(
101
);
o
s
::
set_exit_status
(
101
);
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录