提交 ae339ed9 authored 作者: Serhij S's avatar Serhij S

exec reload function

上级 d36d8dcd
...@@ -364,6 +364,21 @@ pub fn configure_logger(filter: LevelFilter) { ...@@ -364,6 +364,21 @@ pub fn configure_logger(filter: LevelFilter) {
builder.init(); builder.init();
} }
/// Reload the current executable (performs execvp syscall, Linux only)
#[cfg(target_os = "linux")]
pub fn reload_executable() -> Result<()> {
std::os::unix::process::CommandExt::exec(&mut std::process::Command::new(
std::env::current_exe()?,
));
Ok(())
}
/// Reload the current executable (performs execvp syscall, Linux only)
#[cfg(not(target_os = "linux"))]
pub fn reload_executable() -> Result {
Err(Error::Unimplemented)
}
/// Prelude module /// Prelude module
pub mod prelude { pub mod prelude {
pub use super::suicide; pub use super::suicide;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论