mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-27 00:00:03 +03:00
Fix showing stdout and stderr
This commit is contained in:
parent
a8ddc07a9a
commit
c8d217ad50
|
@ -60,13 +60,15 @@ impl<'a> WatchState<'a> {
|
||||||
|
|
||||||
pub fn run_exercise(&mut self) -> Result<bool> {
|
pub fn run_exercise(&mut self) -> Result<bool> {
|
||||||
let output = self.exercise.run()?;
|
let output = self.exercise.run()?;
|
||||||
|
self.stdout = Some(output.stdout);
|
||||||
|
|
||||||
if !output.status.success() {
|
if !output.status.success() {
|
||||||
self.stdout = Some(output.stdout);
|
|
||||||
self.stderr = Some(output.stderr);
|
self.stderr = Some(output.stderr);
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.stderr = None;
|
||||||
|
|
||||||
if let State::Pending(context) = self.exercise.state()? {
|
if let State::Pending(context) = self.exercise.state()? {
|
||||||
let mut message = format!(
|
let mut message = format!(
|
||||||
"
|
"
|
||||||
|
@ -98,7 +100,6 @@ You can keep working on this exercise or jump into the next one by removing the
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.stdout = Some(output.stdout);
|
|
||||||
self.message = Some(message);
|
self.message = Some(message);
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue