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 e13ae51f3636235168c3887b5d531d234dc363bb
parent 10e7b94c304d215ad4a1ff326233098ab182d0b1
2 failed (2 total) View logs
1 file changed +12 -2
modified crates/radicle-cli/src/git/unified_diff.rs
@@ -586,10 +586,20 @@ 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}")
        }
    }