Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions console_backend/src/bin/fileio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ fn main() -> Result<()> {
let file = fs::File::open(source)?;
let size = file.metadata()?.len() as usize;
let mut bytes_written = 0;
eprint!("\rWriting 0.0%...");
print!("\rWriting 0.0%...");
fileio.overwrite_with_progress(dest, file, |n| {
bytes_written += n;
let progress = (bytes_written as f64) / (size as f64) * 100.0;
eprint!("\rWriting {:.2}%...", progress);
print!("\rWriting {:.2}%...", progress);
})?;
eprintln!("\nFile written successfully.");
println!("\nFile written successfully ({} bytes).", bytes_written);
done_tx.send(true).unwrap();
Result::Ok(())
})
Expand All @@ -101,7 +101,7 @@ fn main() -> Result<()> {
scope(|s| {
s.spawn(|_| run(rdr));
let mut fileio = Fileio::new(link, sender);
let dest: Box<dyn Write> = match dest {
let dest: Box<dyn Write + Send> = match dest {
Some(path) => Box::new(fs::File::create(path)?),
None => Box::new(io::stdout()),
};
Expand Down
1 change: 1 addition & 0 deletions console_backend/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ pub(crate) const FILEIO_CHANNEL_SEND_FAILURE: &str =
pub(crate) const SOLUTION_POSITION_UNIT_SELECTION_NOT_AVAILABLE: &str =
"solution position unit selection not available";
pub(crate) const PROCESS_MESSAGES_FAILURE: &str = "process_messages thread panicked";
pub(crate) const THREAD_START_FAILURE: &str = "failed to start a new thread";
Loading