Skip to content

Commit f68857f

Browse files
committed
fix: Trim trailing newlines from cppfilt input
I noticed this when looking at `logging` output.
1 parent 1e51bce commit f68857f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

examples/cppfilt.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,14 @@ where
6868
let mut buf = vec![];
6969

7070
while input.read_until(b'\n', &mut buf)? > 0 {
71+
let nl = buf.ends_with(&[b'\n']);
72+
if nl {
73+
buf.pop();
74+
}
7175
demangle_line(out, &buf[..], options)?;
76+
if nl {
77+
write!(out, "\n")?;
78+
}
7279
buf.clear();
7380
}
7481

0 commit comments

Comments
 (0)