rust/tests/fail/fs/write_to_stdin.rs

14 lines
278 B
Rust
Raw Normal View History

2022-07-08 11:08:32 -05:00
//@ignore-windows: No libc on Windows
#![feature(rustc_private)]
extern crate libc;
fn main() -> std::io::Result<()> {
let bytes = b"hello";
unsafe {
libc::write(0, bytes.as_ptr() as *const libc::c_void, 5); //~ ERROR cannot write to stdin
}
Ok(())
}