diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-27 12:36:17 +0100 |
---|---|---|
committer | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-27 12:36:17 +0100 |
commit | 442072d746c06c61923d85b8e33f4201a7bd57ab (patch) | |
tree | c6a49bf13df5cd5529f9145391c7922ef17eb3a7 /crates/ra_tools/src/lib.rs | |
parent | d23a7558702bcffd9c551bea444475f4a76ba201 (diff) | |
parent | ecb1327fed1ece4083aa09255dbd927c5df304ef (diff) |
Merge #1597
1597: Overhaul installation process r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_tools/src/lib.rs')
-rw-r--r-- | crates/ra_tools/src/lib.rs | 23 |
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 | ||
82 | pub struct Cmd { | ||
83 | pub unix: &'static str, | ||
84 | pub windows: &'static str, | ||
85 | pub work_dir: &'static str, | ||
86 | } | ||
87 | |||
88 | impl 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 | |||
82 | pub fn run(cmdline: &str, dir: &str) -> Result<()> { | 105 | pub 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()); |