(bytes: &[u8])
| 128 | |
| 129 | #[cfg(all(windows, feature = "wsl"))] |
| 130 | fn process_utf16(bytes: &[u8]) -> Result<String, FromUtf16Error> { |
| 131 | let u16_bytes: Vec<u16> = bytes |
| 132 | .chunks_exact(2) |
| 133 | .filter_map(|c| Some(u16::from_ne_bytes(c.try_into().ok()?))) |
| 134 | .collect(); |
| 135 | String::from_utf16(&u16_bytes) |
| 136 | } |
| 137 | |
| 138 | #[cfg(all(windows, feature = "wsl"))] |
| 139 | fn wsl_cmd(args: &[&str]) -> Result<String> { |