add Drop for CGroup

This commit is contained in:
mii
2024-10-31 13:25:35 +09:00
parent 40aa3cde50
commit 2245d7c088

View File

@ -17,6 +17,13 @@ pub struct CGroup {
pub path: PathBuf,
}
impl Drop for CGroup {
fn drop(&mut self) {
let root = self.get_root_path();
let _ = fs::remove_dir(root);
}
}
impl CGroup {
pub fn new(path: &str) -> Result<Self, std::io::Error> {
info!("creating new cgroup");