summaryrefslogtreecommitdiffstats
path: root/vendor/console/src/wasm_term.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
commitc23a457e72abe608715ac76f076f47dc42af07a5 (patch)
tree2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /vendor/console/src/wasm_term.rs
parentReleasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz
rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/console/src/wasm_term.rs')
-rw-r--r--vendor/console/src/wasm_term.rs54
1 files changed, 54 insertions, 0 deletions
diff --git a/vendor/console/src/wasm_term.rs b/vendor/console/src/wasm_term.rs
new file mode 100644
index 000000000..764bc3414
--- /dev/null
+++ b/vendor/console/src/wasm_term.rs
@@ -0,0 +1,54 @@
+use std::fmt::Display;
+use std::io;
+
+use crate::kb::Key;
+use crate::term::Term;
+
+pub use crate::common_term::*;
+
+pub const DEFAULT_WIDTH: u16 = 80;
+
+#[inline]
+pub fn is_a_terminal(_out: &Term) -> bool {
+ #[cfg(target = "wasm32-wasi")]
+ {
+ unsafe { libc::isatty(out.as_raw_fd()) != 0 }
+ }
+ #[cfg(not(target = "wasm32-wasi"))]
+ {
+ false
+ }
+}
+
+#[inline]
+pub fn is_a_color_terminal(_out: &Term) -> bool {
+ // We currently never report color terminals. For discussion see
+ // the issue in the WASI repo: https://github.com/WebAssembly/WASI/issues/162
+ false
+}
+
+#[inline]
+pub fn terminal_size(_out: &Term) -> Option<(u16, u16)> {
+ None
+}
+
+pub fn read_secure() -> io::Result<String> {
+ Err(io::Error::new(
+ io::ErrorKind::Other,
+ "unsupported operation",
+ ))
+}
+
+pub fn read_single_key() -> io::Result<Key> {
+ Err(io::Error::new(
+ io::ErrorKind::Other,
+ "unsupported operation",
+ ))
+}
+
+#[inline]
+pub fn wants_emoji() -> bool {
+ false
+}
+
+pub fn set_title<T: Display>(_title: T) {}