Properly interleave stdout and stderr when running the importer from the UI, for and
This makes the logs understandable and should fix the issue where the
last line of one_step_import's output is sometimes a warning instead of
the map name.
@@ -37,7 +37,7 @@ impl<A: AppLike + 'static> RunCommand<A> {
&args,
subprocess::PopenConfig {
stdout: subprocess::Redirection::Pipe,
- stderr: subprocess::Redirection::Pipe,
+ stderr: subprocess::Redirection::Merge,
..Default::default()
},
) {
@@ -75,9 +75,8 @@ impl<A: AppLike + 'static> RunCommand<A> {
// This is almost always a timeout.
Err(err) => err.capture,
};
- // TODO This doesn't interleave stdout and stderr as expected.
- for raw in vec![stdout, stderr] {
- if let Some(bytes) = raw {
+ assert!(stderr.is_none());
+ if let Some(bytes) = stdout {
if let Ok(string) = String::from_utf8(bytes) {
if !string.is_empty() {
for line in string.split("\n") {
@@ -86,7 +85,6 @@ impl<A: AppLike + 'static> RunCommand<A> {
}
}
}
- }
if !new_lines.is_empty() {
for line in new_lines {
if self.lines.len() == self.max_capacity {
