From 147b54ed02af90d32a19dac5b55c1e53e0fc1cd9 Mon Sep 17 00:00:00 2001 From: ChanTsune <41658782+ChanTsune@users.noreply.github.com> Date: Thu, 5 Sep 2024 13:55:48 +0900 Subject: [PATCH 1/2] Add Emscripten support --- src/lib.rs | 2 +- src/unix.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index cb621c1..f74fb66 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -120,7 +120,7 @@ fn check_description() { "Incorrect function." } else if cfg!(target_os = "illumos") { "Not owner" - } else if cfg!(target_os = "wasi") { + } else if cfg!(target_os = "wasi") || cfg!(target_os = "emscripten") { "Argument list too long" } else if cfg!(target_os = "haiku") { "Operation not allowed" diff --git a/src/unix.rs b/src/unix.rs index 983693b..d2ca222 100644 --- a/src/unix.rs +++ b/src/unix.rs @@ -91,7 +91,8 @@ extern "C" { target_os = "linux", target_os = "hurd", target_os = "redox", - target_os = "dragonfly" + target_os = "dragonfly", + target_os = "emscripten", ), link_name = "__errno_location" )] From 74aaa7bb568a1f996c45517a4788e9256259f8da Mon Sep 17 00:00:00 2001 From: ChanTsune <41658782+ChanTsune@users.noreply.github.com> Date: Thu, 5 Sep 2024 14:05:13 +0900 Subject: [PATCH 2/2] Add CI for emscripten target --- .github/workflows/main.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dffb299..a2bd46d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -51,6 +51,22 @@ jobs: - name: Test (all features) run: CARGO_TARGET_WASM32_WASI_RUNNER=wasmtime cargo test --target wasm32-wasi --all-features + emscripten: + name: Test Emscripten + runs-on: ubuntu-latest + container: emscripten/emsdk:latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install toolchain + uses: dtolnay/rust-toolchain@nightly + with: + targets: wasm32-unknown-emscripten + - name: Test (no features) + run: CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUNNER=node cargo test --target wasm32-unknown-emscripten --no-default-features + - name: Test (all features) + run: CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUNNER=node cargo test --target wasm32-unknown-emscripten --all-features + lints: name: Rustfmt & Clippy