Skip to content

Commit 457e4a9

Browse files
committed
run_command hasn't been driving any TestStatus specific logic for a while now, move it out
1 parent 92b5009 commit 457e4a9

File tree

1 file changed

+15
-21
lines changed

1 file changed

+15
-21
lines changed

src/lib.rs

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ impl dyn TestStatus {
602602
cmd.stdin(std::fs::File::open(stdin).unwrap());
603603
}
604604

605-
let (cmd, status, stderr, stdout) = self.run_command(cmd)?;
605+
let (cmd, status, stderr, stdout) = run_command(cmd)?;
606606

607607
let mode = comments.mode(revision)?;
608608
let cmd = check_test_result(
@@ -629,27 +629,21 @@ impl dyn TestStatus {
629629
)?;
630630
Ok(TestOk::Ok)
631631
}
632+
}
632633

633-
/// Run a command, and if it takes more than 100ms, start appending the last stderr/stdout
634-
/// line to the current status spinner.
635-
fn run_command(
636-
&self,
637-
mut cmd: Command,
638-
) -> Result<(Command, ExitStatus, Vec<u8>, Vec<u8>), Errored> {
639-
match cmd.output() {
640-
Err(err) => Err(Errored {
641-
errors: vec![],
642-
stderr: err.to_string().into_bytes(),
643-
stdout: format!("could not spawn `{:?}` as a process", cmd.get_program())
644-
.into_bytes(),
645-
command: cmd,
646-
}),
647-
Ok(Output {
648-
status,
649-
stdout,
650-
stderr,
651-
}) => Ok((cmd, status, stderr, stdout)),
652-
}
634+
fn run_command(mut cmd: Command) -> Result<(Command, ExitStatus, Vec<u8>, Vec<u8>), Errored> {
635+
match cmd.output() {
636+
Err(err) => Err(Errored {
637+
errors: vec![],
638+
stderr: err.to_string().into_bytes(),
639+
stdout: format!("could not spawn `{:?}` as a process", cmd.get_program()).into_bytes(),
640+
command: cmd,
641+
}),
642+
Ok(Output {
643+
status,
644+
stdout,
645+
stderr,
646+
}) => Ok((cmd, status, stderr, stdout)),
653647
}
654648
}
655649

0 commit comments

Comments
 (0)