Feat/update progress (#1944)

* uodate FE to show progress once calculated

* update mocks

* only show progress when known

Co-authored-by: Aiden McClelland <me@drbonez.dev>
This commit is contained in:
Matt Hill
2022-11-15 20:57:03 -07:00
committed by Aiden McClelland
parent 5b91b5f436
commit 18ee1e2685
9 changed files with 59 additions and 32 deletions

View File

@@ -98,15 +98,17 @@ impl Rsync {
})
.lines();
while let Some(line) = lines.next_line().await? {
if let Some(percentage) = line
.split_ascii_whitespace()
.find_map(|col| col.strip_suffix("%"))
{
if let Err(err) = send.send(percentage.parse::<f64>()? / 100.0) {
return Err(Error::new(
eyre!("rsync progress send error: {}", err),
ErrorKind::Filesystem,
));
if line.contains(" to-chk=0/") {
if let Some(percentage) = line
.split_ascii_whitespace()
.find_map(|col| col.strip_suffix("%"))
{
if let Err(err) = send.send(percentage.parse::<f64>()? / 100.0) {
return Err(Error::new(
eyre!("rsync progress send error: {}", err),
ErrorKind::Filesystem,
));
}
}
}
}