mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
dd: support wasm32-wasip1 (#12258)
This commit is contained in:
@@ -37,7 +37,7 @@ jobs:
|
||||
CARGO_TARGET_WASM32_WASIP1_RUNNER: wasmtime
|
||||
run: |
|
||||
# Get all utilities and exclude ones that don't compile for wasm32-wasip1
|
||||
EXCLUDE="dd|df|du|env|expr|mktemp|more|tac|test"
|
||||
EXCLUDE="df|du|env|expr|mktemp|more|tac|test"
|
||||
UTILS=$(./util/show-utils.sh | tr ' ' '\n' | grep -vE "^($EXCLUDE)$" | sed 's/^/-p uu_/' | tr '\n' ' ')
|
||||
cargo test --target wasm32-wasip1 --no-default-features $UTILS
|
||||
- name: Run integration tests via wasmtime
|
||||
|
||||
@@ -190,6 +190,7 @@ feat_wasm = [
|
||||
"csplit",
|
||||
"cut",
|
||||
"date",
|
||||
"dd",
|
||||
"dir",
|
||||
"dircolors",
|
||||
"dirname",
|
||||
|
||||
@@ -17,7 +17,10 @@ pub fn build_lcase_table() -> ConversionTable {
|
||||
// Initialize locale from environment if not already done
|
||||
// SAFETY: setlocale is called with a valid C string and is used to initialize
|
||||
// the locale for character conversion functions
|
||||
unsafe { libc::setlocale(libc::LC_CTYPE, c"".as_ptr()) };
|
||||
#[cfg(not(target_os = "wasi"))]
|
||||
unsafe {
|
||||
libc::setlocale(libc::LC_CTYPE, c"".as_ptr())
|
||||
};
|
||||
|
||||
let mut table = [0u8; 256];
|
||||
for (i, item) in table.iter_mut().enumerate() {
|
||||
@@ -34,7 +37,10 @@ pub fn build_ucase_table() -> ConversionTable {
|
||||
// Initialize locale from environment if not already done
|
||||
// SAFETY: setlocale is called with a valid C string and is used to initialize
|
||||
// the locale for character conversion functions
|
||||
unsafe { libc::setlocale(libc::LC_CTYPE, c"".as_ptr()) };
|
||||
#[cfg(not(target_os = "wasi"))]
|
||||
unsafe {
|
||||
libc::setlocale(libc::LC_CTYPE, c"".as_ptr())
|
||||
};
|
||||
|
||||
let mut table = [0u8; 256];
|
||||
for (i, item) in table.iter_mut().enumerate() {
|
||||
|
||||
+3
-1
@@ -359,7 +359,7 @@ struct Input<'a> {
|
||||
impl<'a> Input<'a> {
|
||||
/// Instantiate this struct with stdin as a source.
|
||||
fn new_stdin(settings: &'a Settings) -> UResult<Self> {
|
||||
#[cfg(not(unix))]
|
||||
#[cfg(windows)]
|
||||
let mut src = {
|
||||
let f = File::from(io::stdin().as_handle().try_clone_to_owned()?);
|
||||
let is_file = if let Ok(metadata) = f.metadata() {
|
||||
@@ -378,6 +378,8 @@ impl<'a> Input<'a> {
|
||||
Source::Stdin(io::stdin())
|
||||
}
|
||||
};
|
||||
#[cfg(all(not(unix), not(windows)))]
|
||||
let mut src = Source::Stdin(io::stdin());
|
||||
#[cfg(unix)]
|
||||
let mut src = Source::stdin_as_file();
|
||||
#[cfg(unix)]
|
||||
|
||||
Reference in New Issue
Block a user