Initial commit
This commit is contained in:
+35
@@ -0,0 +1,35 @@
|
||||
use std::{error::Error, process::Command};
|
||||
|
||||
use shy_launcher::{config::Config, downloader};
|
||||
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() -> Result<(), Box<dyn Error>> {
|
||||
println!("Starting app launcher...");
|
||||
let config = Config::load("config.json")?;
|
||||
|
||||
println!("Starting download...");
|
||||
downloader::download(config.downloads()).await;
|
||||
|
||||
println!("Freeing memory...");
|
||||
if unsafe { libc::malloc_trim(0) } == 1 {
|
||||
println!("Freed up some memory.");
|
||||
}
|
||||
|
||||
println!("Launching app...");
|
||||
println!();
|
||||
println!("--------------------------");
|
||||
println!();
|
||||
|
||||
let mut child = Command::new(config.run())
|
||||
.args(config.args())
|
||||
.spawn()?;
|
||||
|
||||
let exit = child.wait()?;
|
||||
|
||||
println!();
|
||||
println!("--------------------------");
|
||||
println!();
|
||||
println!("Child exited: {exit}");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user