Skip to content
Snippets Groups Projects
Commit 739fa7b8 authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Merge branch 'master' into 'master'

Update dependencies

See merge request !198
parents 7b082f01 179529d2
No related branches found
No related tags found
1 merge request!198Update dependencies
Pipeline #16446 passed
...@@ -15,7 +15,7 @@ keywords = ["tty", "color", "terminal", "password", "tui"] ...@@ -15,7 +15,7 @@ keywords = ["tty", "color", "terminal", "password", "tui"]
exclude = ["target", "CHANGELOG.md", "image.png", "Cargo.lock"] exclude = ["target", "CHANGELOG.md", "image.png", "Cargo.lock"]
[dependencies] [dependencies]
numtoa = { version = "0.1", features = ["std"]} numtoa = { version = "0.2.4"}
serde = { version = "1.0", features = ["derive"], optional = true } serde = { version = "1.0", features = ["derive"], optional = true }
[target.'cfg(not(target_os = "redox"))'.dependencies] [target.'cfg(not(target_os = "redox"))'.dependencies]
...@@ -23,4 +23,4 @@ libc = "0.2" ...@@ -23,4 +23,4 @@ libc = "0.2"
[target.'cfg(target_os = "redox")'.dependencies] [target.'cfg(target_os = "redox")'.dependencies]
redox_termios = "0.1.3" redox_termios = "0.1.3"
libredox = "0.0.2" libredox = "0.1.3"
...@@ -2,7 +2,7 @@ use std::convert::TryInto; ...@@ -2,7 +2,7 @@ use std::convert::TryInto;
use std::io; use std::io;
use std::os::fd::{AsRawFd, BorrowedFd}; use std::os::fd::{AsRawFd, BorrowedFd};
use super::{cvt, Termios}; use super::Termios;
pub fn get_terminal_attr(fd: BorrowedFd) -> io::Result<Termios> { pub fn get_terminal_attr(fd: BorrowedFd) -> io::Result<Termios> {
let mut termios = Termios::default(); let mut termios = Termios::default();
...@@ -11,8 +11,8 @@ pub fn get_terminal_attr(fd: BorrowedFd) -> io::Result<Termios> { ...@@ -11,8 +11,8 @@ pub fn get_terminal_attr(fd: BorrowedFd) -> io::Result<Termios> {
.as_raw_fd() .as_raw_fd()
.try_into() .try_into()
.map_err(|e| io::Error::new(io::ErrorKind::InvalidInput, e))?; .map_err(|e| io::Error::new(io::ErrorKind::InvalidInput, e))?;
let fd = cvt(libredox::call::dup(fd, b"termios"))?; let fd = libredox::call::dup(fd, b"termios")?;
let res = cvt(libredox::call::read(fd, &mut termios)); let res = libredox::call::read(fd, &mut termios);
let _ = libredox::call::close(fd); let _ = libredox::call::close(fd);
if res? == termios.len() { if res? == termios.len() {
...@@ -30,8 +30,8 @@ pub fn set_terminal_attr(fd: BorrowedFd, termios: &Termios) -> io::Result<()> { ...@@ -30,8 +30,8 @@ pub fn set_terminal_attr(fd: BorrowedFd, termios: &Termios) -> io::Result<()> {
.as_raw_fd() .as_raw_fd()
.try_into() .try_into()
.map_err(|e| io::Error::new(io::ErrorKind::InvalidInput, e))?; .map_err(|e| io::Error::new(io::ErrorKind::InvalidInput, e))?;
let fd = cvt(libredox::call::dup(fd, b"termios"))?; let fd = libredox::call::dup(fd, b"termios")?;
let res = cvt(libredox::call::write(fd, termios)); let res = libredox::call::write(fd, termios);
let _ = libredox::call::close(fd); let _ = libredox::call::close(fd);
if res? == termios.len() { if res? == termios.len() {
......
extern crate libredox; extern crate libredox;
extern crate redox_termios; extern crate redox_termios;
use std::io;
pub use self::redox_termios::Termios; pub use self::redox_termios::Termios;
pub mod attr; pub mod attr;
pub mod size; pub mod size;
pub mod tty; pub mod tty;
// Support function for converting syscall error to io error
fn cvt(result: Result<usize, libredox::error::Error>) -> io::Result<usize> {
result.map_err(|err| io::Error::from_raw_os_error(err.errno))
}
use std::io; use std::io;
use super::{cvt, redox_termios}; use super::redox_termios;
/// Get the size of the terminal. /// Get the size of the terminal.
pub fn terminal_size() -> io::Result<(u16, u16)> { pub fn terminal_size() -> io::Result<(u16, u16)> {
let mut winsize = redox_termios::Winsize::default(); let mut winsize = redox_termios::Winsize::default();
let fd = cvt(libredox::call::dup(1, b"winsize"))?; let fd = libredox::call::dup(1, b"winsize")?;
let res = cvt(libredox::call::read(fd, &mut winsize)); let res = libredox::call::read(fd, &mut winsize);
let _ = libredox::call::close(fd); let _ = libredox::call::close(fd);
if res? == winsize.len() { if res? == winsize.len() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment