Skip to content

Commit

Permalink
Merge pull request #91 from dunnock/wasi
Browse files Browse the repository at this point in the history
Add elementary wasi support
  • Loading branch information
a8m committed Nov 21, 2019
2 parents a69a748 + ec58291 commit 6235728
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
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)
}

0 comments on commit 6235728

Please sign in to comment.