message: Simplify line splitting code in `exec_with_streaming` NFC
diff: @@ -256,17 +256,9 @@ impl ProcessBuilder {
  None => return,
  }
  };
  - {
  - // scope for new_lines
  - let new_lines = if capture_output {
  - let dst = if is_out { &mut stdout } else { &mut stderr };
  - let start = dst.len();
  - let data = data.drain(..idx);
  - dst.extend(data);
  - &dst[start..]
  - } else {
  - &data[..idx]
  - };
  +
  + let new_lines = &data[..idx];
  +
  for line in String::from_utf8_lossy(new_lines).lines() {
  if callback_error.is_some() {
  break;
  @@ -278,12 +270,16 @@ impl ProcessBuilder {
  };
  if let Err(e) = callback_result {
  callback_error = Some(e);
  + break;
  }
  }
  +
  + if capture_output {
  + let dst = if is_out { &mut stdout } else { &mut stderr };
  + dst.extend(new_lines);
  }
  - if !capture_output {
  +
  data.drain(..idx);
  - }
  })?;
  child.wait()
  })()
  