Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli/diff: Print cross-platform line endings
✗ CI failure Lorenz Leutgeb committed 6 months ago
commit a482a1a9f2e0cbf030bce8ef690cad06da74bf53
parent 10e7b94c304d215ad4a1ff326233098ab182d0b1
2 failed (2 total) View logs
1 file changed +8 -2
modified crates/radicle-cli/src/git/unified_diff.rs
@@ -586,10 +586,16 @@ impl<'a> Writer<'a> {
    }

    pub fn write(&mut self, s: impl fmt::Display, style: term::Style) -> io::Result<()> {
+
        #[cfg(windows)]
+
        const EOL: &str = "\r\n";
+

+
        #[cfg(not(windows))]
+
        const EOL: &str = "\n";
+

        if self.styled {
-
            writeln!(self.stream, "{}", term::Paint::new(s).with_style(style))
+
            write!(self.stream, "{}{EOL}", term::Paint::new(s).with_style(style))
        } else {
-
            writeln!(self.stream, "{s}")
+
            write!(self.stream, "{s}{EOL}")
        }
    }