diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-03-31 14:41:59 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-03-31 14:46:11 -0700 |
| commit | 71982aa65725a2e630b3abdbb5f48e1abf1acf91 (patch) | |
| tree | d90f4cf1e4464e949d155cd7e540f3889e287cf3 /src/libstd/sys/unix | |
| parent | 80bf31dd514055177b22c3dc66836d39eb5b1648 (diff) | |
| download | rust-71982aa65725a2e630b3abdbb5f48e1abf1acf91.tar.gz rust-71982aa65725a2e630b3abdbb5f48e1abf1acf91.zip | |
std: Add a process::exit function
This commit is an implementation of [RFC #1011][rfc] which adds an `exit` function to the standard library for immediately terminating the current process with a specified exit code. [rfc]: https://github.com/rust-lang/rfcs/pull/1011
Diffstat (limited to 'src/libstd/sys/unix')
| -rw-r--r-- | src/libstd/sys/unix/os.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index fab443feebd..2ff7eba5732 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -505,3 +505,7 @@ pub fn home_dir() -> Option<PathBuf> { } } } + +pub fn exit(code: i32) -> ! { + unsafe { libc::exit(code as c_int) } +} |
