tty: Build tty.wasm

This commit is contained in:
oech3
2026-04-29 15:56:41 +02:00
committed by Daniel Hofstetter
parent 282bcd8c13
commit e3b4b41247
3 changed files with 10 additions and 2 deletions
+1 -1
View File
@@ -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|tty"
EXCLUDE="dd|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
+1
View File
@@ -235,6 +235,7 @@ feat_wasm = [
"true",
"truncate",
"tsort",
"tty",
"uname",
"unexpand",
"uniq",
+8 -1
View File
@@ -49,7 +49,14 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
set_exit_code(1);
writeln!(stdout, "{}", translate!("tty-not-a-tty"))
};
#[cfg(target_os = "wasi")]
let write_result = if std::io::stdin().is_terminal() {
// maximize compatibility
writeln!(stdout, r"/dev/tty")
} else {
set_exit_code(1);
writeln!(stdout, "{}", translate!("tty-not-a-tty"))
};
#[cfg(target_os = "windows")]
let write_result = if std::io::stdin().is_terminal() {
writeln!(stdout, r"\\.\CON")