mirror of
https://github.com/uutils/coreutils
synced 2024-12-14 15:22:38 +00:00
pr: throw error on reading from socket
This commit is contained in:
parent
1cf84a7305
commit
8c7cbf65a5
1 changed files with 6 additions and 2 deletions
|
@ -98,9 +98,14 @@ quick_error! {
|
||||||
EncounteredErrors(msg: String) {
|
EncounteredErrors(msg: String) {
|
||||||
display("pr: {0} encountered", msg)
|
display("pr: {0} encountered", msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
IsDirectory(path: String) {
|
IsDirectory(path: String) {
|
||||||
display("pr: {0}: Is a directory", path)
|
display("pr: {0}: Is a directory", path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IsSocket(path: String) {
|
||||||
|
display("pr: cannot open {}, Operation not supported on socket", path)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,8 +245,7 @@ fn open(path: &str) -> Result<Box<Read>, PrError> {
|
||||||
Some(InputType::Directory) => Err(PrError::IsDirectory(path.to_string())),
|
Some(InputType::Directory) => Err(PrError::IsDirectory(path.to_string())),
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
Some(InputType::Socket) => {
|
Some(InputType::Socket) => {
|
||||||
// TODO Add reading from socket
|
Err(PrError::IsSocket(path.to_string()))
|
||||||
Err(PrError::EncounteredErrors("Reading from socket not supported yet".to_string()))
|
|
||||||
}
|
}
|
||||||
Some(InputType::StdIn) => {
|
Some(InputType::StdIn) => {
|
||||||
let stdin = stdin();
|
let stdin = stdin();
|
||||||
|
|
Loading…
Reference in a new issue