1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use std::process::{Command, Stdio};
use crate::core::{Manager, Task};
pub struct InstallTarget(pub &'static str);
impl Task for InstallTarget {
type Context = ();
type Error = std::io::Error;
fn verb(&self) -> &str {
"Installing"
}
fn message(&self) -> &str {
"target"
}
fn detail(&self) -> &str {
self.0
}
fn run(
&self,
context: Self::Context,
_manager: &mut Manager,
) -> Result<Self::Context, Self::Error> {
Command::new("rustup")
.arg("target")
.arg("add")
.arg(self.0)
.stderr(Stdio::null())
.spawn()?
.wait()?;
Ok(context)
}
}