Skip to content

Commit e0107c0

Browse files
authored
Support emscripten (#100)
* Add Emscripten support * Add CI for emscripten target
1 parent b667e6b commit e0107c0

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

.github/workflows/main.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,22 @@ jobs:
5151
- name: Test (all features)
5252
run: CARGO_TARGET_WASM32_WASI_RUNNER=wasmtime cargo test --target wasm32-wasi --all-features
5353

54+
emscripten:
55+
name: Test Emscripten
56+
runs-on: ubuntu-latest
57+
container: emscripten/emsdk:latest
58+
steps:
59+
- name: Checkout repository
60+
uses: actions/checkout@v4
61+
- name: Install toolchain
62+
uses: dtolnay/rust-toolchain@nightly
63+
with:
64+
targets: wasm32-unknown-emscripten
65+
- name: Test (no features)
66+
run: CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUNNER=node cargo test --target wasm32-unknown-emscripten --no-default-features
67+
- name: Test (all features)
68+
run: CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUNNER=node cargo test --target wasm32-unknown-emscripten --all-features
69+
5470

5571
lints:
5672
name: Rustfmt & Clippy

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ fn check_description() {
120120
"Incorrect function."
121121
} else if cfg!(target_os = "illumos") {
122122
"Not owner"
123-
} else if cfg!(target_os = "wasi") {
123+
} else if cfg!(target_os = "wasi") || cfg!(target_os = "emscripten") {
124124
"Argument list too long"
125125
} else if cfg!(target_os = "haiku") {
126126
"Operation not allowed"

src/unix.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ extern "C" {
9191
target_os = "linux",
9292
target_os = "hurd",
9393
target_os = "redox",
94-
target_os = "dragonfly"
94+
target_os = "dragonfly",
95+
target_os = "emscripten",
9596
),
9697
link_name = "__errno_location"
9798
)]

0 commit comments

Comments
 (0)