Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 82fd867

Browse filesBrowse files
committed
Try to fix universal write on windows
1 parent e4be882 commit 82fd867
Copy full SHA for 82fd867

File tree

1 file changed

+3
-5
lines changed
Filter options

1 file changed

+3
-5
lines changed

‎vm/src/stdlib/io.rs

Copy file name to clipboardExpand all lines: vm/src/stdlib/io.rs
+3-5Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2750,15 +2750,13 @@ mod _io {
27502750
let data = obj.as_str();
27512751

27522752
let replace_nl = match textio.newline {
2753+
Newlines::Lf => Some("\n"),
27532754
Newlines::Cr => Some("\r"),
27542755
Newlines::Crlf => Some("\r\n"),
2756+
Newlines::Universal if cfg!(windows) => Some("\r\n"),
27552757
_ => None,
27562758
};
2757-
let has_lf = if replace_nl.is_some() || textio.line_buffering {
2758-
data.contains('\n')
2759-
} else {
2760-
false
2761-
};
2759+
let has_lf = (replace_nl.is_some() || textio.line_buffering) && data.contains('\n');
27622760
let flush = textio.line_buffering && (has_lf || data.contains('\r'));
27632761
let chunk = if let Some(replace_nl) = replace_nl {
27642762
if has_lf {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.