Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ feat_wasm = [
"shred",
"shuf",
"sleep",
"sort",
"sum",
"tee",
"true",
Expand Down
2 changes: 1 addition & 1 deletion src/uu/sort/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ uucore = { workspace = true, features = [
fluent = { workspace = true }
foldhash = { workspace = true }

[target.'cfg(not(target_os = "redox"))'.dependencies]
[target.'cfg(not(any(target_os = "redox", target_os = "wasi")))'.dependencies]
ctrlc = { workspace = true }

[target.'cfg(unix)'.dependencies]
Expand Down
4 changes: 2 additions & 2 deletions src/uu/sort/src/tmp_dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fn should_install_signal_handler() -> bool {
open_fds.saturating_add(CTRL_C_FDS + RESERVED_FOR_MERGE) <= limit
}

#[cfg(not(target_os = "redox"))]
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
fn ensure_signal_handler_installed(state: Arc<Mutex<HandlerRegistration>>) -> UResult<()> {
// This shared state must originate from `HANDLER_STATE` so the handler always sees
// the current lock/path pair and can clean up the active temp directory on SIGINT.
Expand Down Expand Up @@ -104,7 +104,7 @@ fn ensure_signal_handler_installed(state: Arc<Mutex<HandlerRegistration>>) -> UR
Ok(())
}

#[cfg(target_os = "redox")]
#[cfg(any(target_os = "redox", target_os = "wasi"))]
fn ensure_signal_handler_installed(_state: Arc<Mutex<HandlerRegistration>>) -> UResult<()> {
Ok(())
}
Expand Down
1 change: 1 addition & 0 deletions src/uucore/src/lib/features/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ impl Hash for FileInformation {
#[cfg(target_os = "wasi")]
{
self.0.len().hash(state);
self.0.file_type().is_dir().hash(state);
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/uucore/src/lib/features/fsext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use crate::os_str_from_bytes;
#[cfg(windows)]
use crate::show_warning;

#[cfg(not(target_os = "wasi"))]
use std::ffi::OsStr;
#[cfg(unix)]
use std::os::unix::ffi::OsStrExt;
Expand Down Expand Up @@ -64,13 +65,14 @@ use libc::{
};
#[cfg(unix)]
use std::ffi::{CStr, CString};
#[cfg(not(target_os = "wasi"))]
use std::io::Error as IOError;
#[cfg(unix)]
use std::mem;
#[cfg(windows)]
use std::path::Path;
use std::time::SystemTime;
#[cfg(not(windows))]
#[cfg(unix)]
use std::time::UNIX_EPOCH;
use std::{borrow::Cow, ffi::OsString};

Expand Down
9 changes: 8 additions & 1 deletion src/uucore/src/lib/mods/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,14 @@ impl OwnedFileDescriptorOrHandle {
/// instantiates a corresponding `Stdio`
#[cfg(not(target_os = "wasi"))]
pub fn into_stdio(self) -> Stdio {
Stdio::from(self.fx)
#[cfg(not(target_os = "wasi"))]
{
Stdio::from(self.fx)
}
#[cfg(target_os = "wasi")]
{
Stdio::from(File::from(self.fx))
}
}

/// WASI: Stdio::from(OwnedFd) is not available, convert via File instead.
Expand Down
Loading