16 lines
445 B
Rust
16 lines
445 B
Rust
use nix::libc;
|
|
use nix::sys::ptrace::traceme;
|
|
use nix::unistd::execv;
|
|
use std::ffi::CString;
|
|
|
|
pub fn starti(child_exec_path: CString) -> ! {
|
|
// ⚠️ There is a limited amount of things that can be done here, see fork's safety
|
|
match traceme() {
|
|
Ok(_) => {
|
|
execv(&child_exec_path, &[&child_exec_path]).unwrap();
|
|
unreachable!();
|
|
}
|
|
Err(errno) => unsafe { libc::exit(errno as i32) },
|
|
}
|
|
}
|