7 #![feature(rustc_private)]
17 use std::process::Command;
18 use std::os::unix::prelude::*;
20 let mut p = Command::new("/bin/sh")
21 .arg("-c").arg("true")
22 .uid(unsafe { libc::getuid() })
23 .gid(unsafe { libc::getgid() })
25 assert!(p.wait().unwrap().success());
27 // if we're already root, this isn't a valid test. Most of the bots run
28 // as non-root though (android is an exception).
29 if unsafe { libc::getuid() != 0 } {
30 assert!(Command::new("/bin/ls").uid(0).gid(0).spawn().is_err());