2018-11-26 05:31:32 +00:00
|
|
|
//! When wasmer self-update is executed, this is what gets executed
|
2018-11-28 21:25:56 +00:00
|
|
|
use std::process::{Command, Stdio};
|
2018-11-26 05:31:32 +00:00
|
|
|
|
|
|
|
pub fn self_update() {
|
|
|
|
println!("Fetching latest installer");
|
2018-11-28 21:25:56 +00:00
|
|
|
let cmd = Command::new("curl")
|
|
|
|
.arg("https://get.wasmer.io")
|
|
|
|
.arg("-sSfL")
|
|
|
|
.stdout(Stdio::piped())
|
|
|
|
.spawn()
|
|
|
|
.unwrap();
|
2018-11-26 05:31:32 +00:00
|
|
|
|
2018-11-28 21:25:56 +00:00
|
|
|
let mut the_process = Command::new("sh")
|
|
|
|
.stdin(cmd.stdout.unwrap())
|
|
|
|
.stdout(Stdio::inherit())
|
|
|
|
.spawn()
|
|
|
|
.ok()
|
|
|
|
.expect("Failed to execute.");
|
2018-11-26 05:31:32 +00:00
|
|
|
|
2018-11-28 21:29:50 +00:00
|
|
|
the_process.wait().unwrap();
|
2018-11-26 05:31:32 +00:00
|
|
|
}
|