aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_tools/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_tools/src/lib.rs')
-rw-r--r--crates/ra_tools/src/lib.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/crates/ra_tools/src/lib.rs b/crates/ra_tools/src/lib.rs
index 79fbcd11d..bb7845f7d 100644
--- a/crates/ra_tools/src/lib.rs
+++ b/crates/ra_tools/src/lib.rs
@@ -79,6 +79,29 @@ pub fn project_root() -> PathBuf {
79 Path::new(&env!("CARGO_MANIFEST_DIR")).ancestors().nth(2).unwrap().to_path_buf() 79 Path::new(&env!("CARGO_MANIFEST_DIR")).ancestors().nth(2).unwrap().to_path_buf()
80} 80}
81 81
82pub struct Cmd {
83 pub unix: &'static str,
84 pub windows: &'static str,
85 pub work_dir: &'static str,
86}
87
88impl Cmd {
89 pub fn run(self) -> Result<()> {
90 if cfg!(windows) {
91 run(self.windows, self.work_dir)
92 } else {
93 run(self.unix, self.work_dir)
94 }
95 }
96 pub fn run_with_output(self) -> Result<Output> {
97 if cfg!(windows) {
98 run_with_output(self.windows, self.work_dir)
99 } else {
100 run_with_output(self.unix, self.work_dir)
101 }
102 }
103}
104
82pub fn run(cmdline: &str, dir: &str) -> Result<()> { 105pub fn run(cmdline: &str, dir: &str) -> Result<()> {
83 do_run(cmdline, dir, |c| { 106 do_run(cmdline, dir, |c| {
84 c.stdout(Stdio::inherit()); 107 c.stdout(Stdio::inherit());