Locking stderr and the progress bar in SSH

[?]
Dec 5, 2020, 3:24 PM
KTTKF3RWYAK2YSH2DYYW5QVG4KSNGWUBJBFHKE24OJ7LFCBF5FEAC

Dependencies

  • [2] PCEJFKFX Progress bar for upload and apply
  • [3] SZWBLWZ4 Reading ~/.ssh/config
  • [4] K6GWUOD5 Styling progress bars
  • [5] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [6] UDHP4ZVB Fixing SSH asynchronicity issues
  • [7] QE64ATLZ Fixing asynchronicity problems in SSH
  • [8] Q45QHPO4 Feedback on network stuff
  • [9] 367UBQ6K Forwarding SSH stderr, and progress bar for push
  • [10] WLUID7NA Do not block when downloading more than 100 changes over SSH
  • [11] Q7CAYX5N Fixing Windows compilation

Change contents

  • replacement in pijul/src/remote/ssh.rs at line 35
    [4.26182][4.26182:26197]()
    .unwrap();
    [4.26182]
    [4.26197]
    .unwrap();
    static ref PROGRESS: Arc<Mutex<Option<ProgressBar>>> = Arc::new(Mutex::new(None));
  • replacement in pijul/src/remote/ssh.rs at line 341
    [4.268][3.2447:2584]()
    let stderr = std::io::stderr();
    let mut handle = stderr.lock();
    let result = handle.write_all(data);
    [4.268]
    [4.365]
    let data = data.to_vec();
  • replacement in pijul/src/remote/ssh.rs at line 343
    [4.399][4.399:424]()
    result?;
    [4.399]
    [4.424]
    *PROGRESS.lock().await = None;
    let stderr = std::io::stderr();
    let mut handle = stderr.lock();
    handle.write_all(&data)?;
  • edit in pijul/src/remote/ssh.rs at line 692
    [2.166]
    [4.44567]
    *PROGRESS.lock().await = Some(progress);
  • replacement in pijul/src/remote/ssh.rs at line 710
    [4.45306][4.604:633]()
    progress.inc(1);
    [4.45306]
    [4.45306]
    if let Some(ref mut progress) = *PROGRESS.lock().await {
    progress.inc(1);
    }
  • replacement in pijul/src/remote/ssh.rs at line 715
    [4.45389][2.167:335](),[2.335][4.634:661](),[4.45389][4.634:661]()
    progress.set_style(
    indicatif::ProgressStyle::default_bar()
    .template("✓ Uploading changes {wide_bar} {pos}/{len}"),
    );
    progress.finish();
    [4.45389]
    [4.45389]
    if let Some(ref mut progress) = *PROGRESS.lock().await {
    progress.set_style(
    indicatif::ProgressStyle::default_bar()
    .template("✓ Uploading changes {wide_bar} {pos}/{len}"),
    );
    progress.finish();
    }
  • edit in pijul/src/remote/ssh.rs at line 778
    [4.166]
    [4.9753]
    *PROGRESS.lock().await = Some(progress);
  • replacement in pijul/src/remote/ssh.rs at line 781
    [4.9854][4.136:165]()
    progress.inc(1);
    [4.9854]
    [4.427]
    if let Some(ref mut progress) = *PROGRESS.lock().await {
    progress.inc(1);
    }
  • replacement in pijul/src/remote/ssh.rs at line 786
    [4.533][4.533:573]()
    progress.abandon();
    [4.533]
    [4.573]
    if let Some(ref mut progress) = *PROGRESS.lock().await {
    progress.abandon();
    }
  • replacement in pijul/src/remote/ssh.rs at line 793
    [4.213][4.213:250](),[4.250][4.167:351](),[4.351][4.250:281](),[4.250][4.250:281]()
    if !progress.is_finished() {
    progress.set_style(
    indicatif::ProgressStyle::default_bar()
    .template("✓ Downloading changes {wide_bar} {pos}/{len}"),
    );
    progress.finish();
    [4.213]
    [4.49743]
    if let Some(ref mut progress) = *PROGRESS.lock().await {
    if !progress.is_finished() {
    progress.set_style(
    indicatif::ProgressStyle::default_bar()
    .template("✓ Downloading changes {wide_bar} {pos}/{len}"),
    );
    progress.finish();
    }
  • edit in pijul/src/remote/ssh.rs at line 826
    [4.520]
    [4.50173]
    *PROGRESS.lock().await = Some(progress);
  • replacement in pijul/src/remote/ssh.rs at line 841
    [4.51338][4.352:470](),[4.470][4.521:548](),[4.51338][4.521:548]()
    progress
    .set_style(indicatif::ProgressStyle::default_spinner().template("✓ Cloning channel"));
    progress.finish();
    [4.51338]
    [4.51338]
    if let Some(ref mut progress) = *PROGRESS.lock().await {
    progress.set_style(
    indicatif::ProgressStyle::default_spinner().template("✓ Cloning channel"),
    );
    progress.finish();
    }