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