2019-03-21 15:55:23 +00:00
|
|
|
use crate::vfs::file_like::{FileLike, Metadata};
|
|
|
|
use failure::Error;
|
2019-03-26 02:43:52 +00:00
|
|
|
use std::io;
|
|
|
|
use std::io::{Read, Write};
|
2019-03-21 15:55:23 +00:00
|
|
|
|
|
|
|
pub struct Stdin;
|
|
|
|
pub struct Stdout;
|
|
|
|
pub struct Stderr;
|
|
|
|
|
|
|
|
impl FileLike for Stdin {
|
2019-03-26 02:43:52 +00:00
|
|
|
fn metadata(&self) -> Result<Metadata, Error> {
|
|
|
|
unimplemented!()
|
2019-03-21 15:55:23 +00:00
|
|
|
}
|
|
|
|
|
2019-03-26 02:43:52 +00:00
|
|
|
fn write_file(&mut self, _buf: &[u8], _offset: usize) -> Result<usize, io::Error> {
|
2019-03-21 15:55:23 +00:00
|
|
|
unimplemented!()
|
|
|
|
}
|
2019-03-26 02:43:52 +00:00
|
|
|
}
|
2019-03-21 15:55:23 +00:00
|
|
|
|
2019-03-26 02:43:52 +00:00
|
|
|
impl Read for Stdin {
|
|
|
|
fn read(&mut self, _buf: &mut [u8]) -> Result<usize, io::Error> {
|
|
|
|
unimplemented!()
|
2019-03-21 15:55:23 +00:00
|
|
|
}
|
2019-03-26 02:43:52 +00:00
|
|
|
}
|
2019-03-21 15:55:23 +00:00
|
|
|
|
2019-03-26 02:43:52 +00:00
|
|
|
impl FileLike for Stdout {
|
|
|
|
fn metadata(&self) -> Result<Metadata, failure::Error> {
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn write_file(&mut self, buf: &[u8], _offset: usize) -> Result<usize, io::Error> {
|
|
|
|
let stdout = io::stdout();
|
|
|
|
let mut handle = stdout.lock();
|
|
|
|
handle.write(buf)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Read for Stdout {
|
|
|
|
fn read(&mut self, _buf: &mut [u8]) -> Result<usize, io::Error> {
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl FileLike for Stderr {
|
|
|
|
fn metadata(&self) -> Result<Metadata, failure::Error> {
|
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn write_file(&mut self, buf: &[u8], _offset: usize) -> Result<usize, io::Error> {
|
|
|
|
let stderr = io::stderr();
|
|
|
|
let mut handle = stderr.lock();
|
|
|
|
handle.write(buf)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Read for Stderr {
|
|
|
|
fn read(&mut self, _buf: &mut [u8]) -> Result<usize, io::Error> {
|
2019-03-21 15:55:23 +00:00
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
}
|