Fixed wasi isatty tests when being generated

This commit is contained in:
Syrus 2020-02-13 10:33:27 -08:00
parent 62e1526037
commit c287170166

View File

@ -1,3 +1,5 @@
// We don't have access to libc, so we just use isatty
// as an external function
// use libc::isatty;
extern "C" {
@ -5,7 +7,14 @@ extern "C" {
}
fn main() {
println!("stdin: {}", unsafe { isatty(0) });
println!("stdout: {}", unsafe { isatty(1) });
println!("stderr: {}", unsafe { isatty(2) });
#[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");
}
}