Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add elementary wasi support #91

Merged
merged 2 commits into from
Nov 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/tty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ mod unix;
#[cfg(unix)]
pub use self::unix::*;

#[cfg(target_os="wasi")]
mod wasi;
#[cfg(target_os="wasi")]
pub use self::wasi::*;

#[cfg(windows)]
mod windows;
#[cfg(windows)]
Expand Down
16 changes: 16 additions & 0 deletions src/tty/wasi.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
extern crate libc;
use super::{Width, Height};

/// For WASI so far it will return none
///
/// For background https://github.com/WebAssembly/WASI/issues/42
pub fn terminal_size() -> Option<(Width, Height)> {
return None;
}

/// This is inherited from unix and will work only when wasi executed on unix.
///
/// For background https://github.com/WebAssembly/WASI/issues/42
pub fn move_cursor_up(n: usize) -> String {
format!("\x1B[{}A", n)
}