mirror of
https://github.com/uutils/diffutils.git
synced 2026-06-10 15:48:59 -07:00
fix build failure on wasm32-wasip1 target (#215)
Co-authored-by: viju <pocopepe@vijus-MacBook-Air.local>
This commit is contained in:
+9
-4
@@ -11,10 +11,10 @@ use std::iter::Peekable;
|
||||
use std::process::ExitCode;
|
||||
use std::{cmp, fs, io};
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
#[cfg(unix)]
|
||||
use std::os::fd::{AsRawFd, FromRawFd};
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
#[cfg(unix)]
|
||||
use std::os::unix::fs::MetadataExt;
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
@@ -38,7 +38,7 @@ fn usage_string(executable: &str) -> String {
|
||||
format!("Usage: {executable} <from> <to>")
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
#[cfg(unix)]
|
||||
fn is_stdout_dev_null() -> bool {
|
||||
let Ok(dev_null) = fs::metadata("/dev/null") else {
|
||||
return false;
|
||||
@@ -60,6 +60,11 @@ fn is_stdout_dev_null() -> bool {
|
||||
is_dev_null
|
||||
}
|
||||
|
||||
#[cfg(not(any(unix, target_os = "windows")))]
|
||||
fn is_stdout_dev_null() -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
pub fn parse_params<I: Iterator<Item = OsString>>(mut opts: Peekable<I>) -> Result<Params, String> {
|
||||
let Some(executable) = opts.next() else {
|
||||
return Err("Usage: <exe> <from> <to>".to_string());
|
||||
@@ -330,7 +335,7 @@ pub fn cmp(params: &Params) -> Result<Cmp, String> {
|
||||
|
||||
if let (Ok(a_meta), Ok(b_meta)) = (fs::metadata(¶ms.from), fs::metadata(¶ms.to)) {
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
let (a_size, b_size) = (a_meta.size(), b_meta.size());
|
||||
let (a_size, b_size) = (a_meta.len(), b_meta.len());
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
let (a_size, b_size) = (a_meta.file_size(), b_meta.file_size());
|
||||
|
||||
Reference in New Issue
Block a user