|
@@ -8,7 +8,7 @@ use log::debug;
|
|
|
use std::{
|
|
|
ffi::OsStr,
|
|
|
fs::{self, File},
|
|
|
- io::{self, BufReader, BufWriter},
|
|
|
+ io::{self, BufRead, BufReader, BufWriter},
|
|
|
path::Path,
|
|
|
process::{Command, ExitStatus, Output, Stdio},
|
|
|
sync::{Arc, Mutex},
|
|
@@ -165,16 +165,15 @@ impl CommandExt for Command {
|
|
|
let stdout_lines = Arc::new(Mutex::new(Vec::new()));
|
|
|
let stdout_lines_ = stdout_lines.clone();
|
|
|
std::thread::spawn(move || {
|
|
|
- let mut buf = Vec::new();
|
|
|
+ let mut line = String::new();
|
|
|
let mut lines = stdout_lines_.lock().unwrap();
|
|
|
loop {
|
|
|
- buf.clear();
|
|
|
- if let Ok(0) = tauri_utils::io::read_line(&mut stdout, &mut buf) {
|
|
|
+ line.clear();
|
|
|
+ if let Ok(0) = stdout.read_line(&mut line) {
|
|
|
break;
|
|
|
}
|
|
|
- debug!(action = "stdout"; "{}", String::from_utf8_lossy(&buf));
|
|
|
- lines.extend(buf.clone());
|
|
|
- lines.push(b'\n');
|
|
|
+ debug!(action = "stdout"; "{}", &line[0..line.len() - 1]);
|
|
|
+ lines.extend(line.as_bytes().to_vec());
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -182,16 +181,15 @@ impl CommandExt for Command {
|
|
|
let stderr_lines = Arc::new(Mutex::new(Vec::new()));
|
|
|
let stderr_lines_ = stderr_lines.clone();
|
|
|
std::thread::spawn(move || {
|
|
|
- let mut buf = Vec::new();
|
|
|
+ let mut line = String::new();
|
|
|
let mut lines = stderr_lines_.lock().unwrap();
|
|
|
loop {
|
|
|
- buf.clear();
|
|
|
- if let Ok(0) = tauri_utils::io::read_line(&mut stderr, &mut buf) {
|
|
|
+ line.clear();
|
|
|
+ if let Ok(0) = stderr.read_line(&mut line) {
|
|
|
break;
|
|
|
}
|
|
|
- debug!(action = "stderr"; "{}", String::from_utf8_lossy(&buf));
|
|
|
- lines.extend(buf.clone());
|
|
|
- lines.push(b'\n');
|
|
|
+ debug!(action = "stderr"; "{}", &line[0..line.len() - 1]);
|
|
|
+ lines.extend(line.as_bytes().to_vec());
|
|
|
}
|
|
|
});
|
|
|
|