[−][src]Function fork::chdir
pub fn chdir() -> Result<c_int, i32>
Change dir to /
see chdir(2)
Upon successful completion, 0 shall be returned. Otherwise, -1 shall be returned, the current working directory shall remain unchanged, and errno shall be set to indicate the error.
Example:
use fork::chdir; use std::env; fn main() { match chdir() { Ok(_) => { let path = env::current_dir().expect("failed current_dir"); assert_eq!(Some("/"), path.to_str()); } _ => panic!(), } }