move exit-code to rmake
This commit is contained in:
parent
0e5f520788
commit
65df93bbb4
5 changed files with 71 additions and 13 deletions
|
|
@ -183,6 +183,18 @@ impl Rustc {
|
|||
output
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
pub fn run_fail_assert_exit_code(&mut self, code: i32) -> Output {
|
||||
let caller_location = std::panic::Location::caller();
|
||||
let caller_line_number = caller_location.line();
|
||||
|
||||
let output = self.cmd.output().unwrap();
|
||||
if output.status.code().unwrap() != code {
|
||||
handle_failed_output(&format!("{:#?}", self.cmd), output, caller_line_number);
|
||||
}
|
||||
output
|
||||
}
|
||||
|
||||
/// Inspect what the underlying [`Command`] is up to the current construction.
|
||||
pub fn inspect(&mut self, f: impl FnOnce(&Command)) -> &mut Self {
|
||||
f(&self.cmd);
|
||||
|
|
|
|||
|
|
@ -65,6 +65,11 @@ impl Rustdoc {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn arg_path<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
|
||||
self.cmd.arg(path.as_ref());
|
||||
self
|
||||
}
|
||||
|
||||
/// Run the build `rustdoc` command and assert that the run is successful.
|
||||
#[track_caller]
|
||||
pub fn run(&mut self) -> Output {
|
||||
|
|
@ -77,4 +82,16 @@ impl Rustdoc {
|
|||
}
|
||||
output
|
||||
}
|
||||
|
||||
#[track_caller]
|
||||
pub fn run_fail_assert_exit_code(&mut self, code: i32) -> Output {
|
||||
let caller_location = std::panic::Location::caller();
|
||||
let caller_line_number = caller_location.line();
|
||||
|
||||
let output = self.cmd.output().unwrap();
|
||||
if output.status.code().unwrap() != code {
|
||||
handle_failed_output(&format!("{:#?}", self.cmd), output, caller_line_number);
|
||||
}
|
||||
output
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ run-make/emit/Makefile
|
|||
run-make/env-dep-info/Makefile
|
||||
run-make/error-found-staticlib-instead-crate/Makefile
|
||||
run-make/error-writing-dependencies/Makefile
|
||||
run-make/exit-code/Makefile
|
||||
run-make/export-executable-symbols/Makefile
|
||||
run-make/extern-diff-internal-name/Makefile
|
||||
run-make/extern-flag-disambiguates/Makefile
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue