mario death

This commit is contained in:
Aiden McClelland
2021-09-14 14:21:46 -06:00
committed by Aiden McClelland
parent c1db00aebb
commit 9fb57d038a
2 changed files with 32 additions and 34 deletions

View File

@@ -3,8 +3,9 @@ use std::sync::Arc;
use rpc_toolkit::command;
use crate::context::RpcContext;
use crate::disk::main::export_blocking;
use crate::util::display_none;
use crate::disk::main::export;
use crate::sound::MARIO_DEATH;
use crate::util::{display_none, Invoke};
use crate::Error;
#[derive(Debug, Clone)]
@@ -17,23 +18,36 @@ impl Shutdown {
pub fn execute(&self) {
use std::process::Command;
Command::new("systemctl")
.arg("stop")
.arg("systemd-journald")
.spawn()
tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.unwrap()
.wait()
.unwrap();
Command::new("systemctl")
.arg("stop")
.arg("docker")
.spawn()
.unwrap()
.wait()
.unwrap();
if let Err(e) = export_blocking(&self.zfs_pool) {
log::error!("Error Exporting ZFS Pool: {}", e);
}
.block_on(async {
use tokio::process::Command;
if let Err(e) = Command::new("systemctl")
.arg("stop")
.arg("systemd-journald")
.invoke(crate::ErrorKind::Journald)
.await
{
log::error!("Error Stopping Journald: {}", e);
}
if let Err(e) = Command::new("systemctl")
.arg("stop")
.arg("docker")
.invoke(crate::ErrorKind::Docker)
.await
{
log::error!("Error Stopping Docker: {}", e);
}
if let Err(e) = export(&self.zfs_pool).await {
log::error!("Error Exporting ZFS Pool: {}", e);
}
if let Err(e) = MARIO_DEATH.play().await {
log::error!("Error Playing Shutdown Song: {}", e);
}
});
if self.restart {
Command::new("reboot").spawn().unwrap().wait().unwrap();
} else {