From 9332d1643cf5f77d401e343157683ac5efbf6ae5 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 22 Mar 2022 16:04:48 +0800 Subject: [PATCH] irrt: normalize end-of-line characters. Closes #231 --- nac3core/build.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nac3core/build.rs b/nac3core/build.rs index 2c36a3db..a032bb93 100644 --- a/nac3core/build.rs +++ b/nac3core/build.rs @@ -38,11 +38,12 @@ fn main() { }) .unwrap(); - let output = std::str::from_utf8(&output.stdout).unwrap(); + // https://github.com/rust-lang/regex/issues/244 + let output = std::str::from_utf8(&output.stdout).unwrap().replace("\r\n", "\n"); let mut filtered_output = String::with_capacity(output.len()); let regex_filter = regex::Regex::new(r"(?ms:^define.*?\}$)|(?m:^declare.*?$)").unwrap(); - for f in regex_filter.captures_iter(output) { + for f in regex_filter.captures_iter(&output) { assert!(f.len() == 1); filtered_output.push_str(&f[0]); filtered_output.push('\n');