mirror of
https://github.com/fluencelabs/wasmer
synced 2025-03-31 23:11:04 +00:00
21 lines
499 B
Rust
21 lines
499 B
Rust
// We don't have access to libc, so we just use isatty
|
|
// as an external function
|
|
// use libc::isatty;
|
|
|
|
extern "C" {
|
|
pub fn isatty(fd: i32) -> i32;
|
|
}
|
|
|
|
fn main() {
|
|
#[cfg(target = "wasi")] {
|
|
println!("stdin: {}", unsafe { isatty(0) });
|
|
println!("stdout: {}", unsafe { isatty(1) });
|
|
println!("stderr: {}", unsafe { isatty(2) });
|
|
}
|
|
#[cfg(not(target = "wasi"))] {
|
|
println!("stdin: 1");
|
|
println!("stdout: 1");
|
|
println!("stderr: 1");
|
|
}
|
|
}
|