summaryrefslogtreecommitdiff
path: root/src/pty.rs
AgeCommit message (Collapse)Author
2022-02-22also implement Read and Write for &PtyMasterJesse Luehrs
2021-12-26Fix typosRyan Zoeller
2021-12-20feature-gate most Nix functionsVincent Dagonneau
Using features reduces build time and size for consumer crates. By default all features are enabled.
2021-09-19Clippy cleanupAlan Somers
And this time, start running Clippy in CI
2021-07-07Collapse Error into ErrnoAlan Somers
Now that Nix's weird error types are eliminated, there's no reason not to simply use Errno as the Error type.
2021-07-07Overhaul Nix's error typesAlan Somers
For many of Nix's consumers it be convenient to easily convert a Nix error into a std::io::Error. That's currently not possible because of the InvalidPath, InvalidUtf8, and UnsupportedOperation types that have no equivalent in std::io::Error. However, very few of Nix's public APIs actually return those unusual errors. So a more useful API would be for Nix's standard error type to implement Into<std::io::Error>. This commit makes Error a simple NewType around Errno. For most functions it's a drop-in replacement. There are only three exceptions: * clearenv now returns a bespoke error type. It was the only Nix function whose error couldn't be cleanly mapped onto an Errno. * sys::signal::signal now returns Error(Errno::ENOTSUP) instead of Error::UnsupportedOperation when the user passes an incompatible argument to `handler`. * When a NixPath exceeds PATH_MAX, it will now return Error(Errno::ENAMETOOLONG) instead of Error::InvalidPath. In the latter two cases there is now some abiguity about whether the error code was generated by Nix or by the OS. But I think the ambiguity is worth it for the sake of being able to implement Into<io::Error>. This commit also introduces Error::Sys() as a migration aid. Previously that as an enum variant. Now it's a function, but it will work in many of the same contexts as the original. Fixes #1155
2021-07-07ptsname_r now returns a lossily-converted string in the event of bad UTFAlan Somers
2021-05-13Use https instead of httpRyan Zoeller
2021-02-20pty: Make forkpty() unsafeTavian Barnes
After the child returns from a fork() of a multi-threaded process, it is undefined behaviour to call non-async-signal-safe functions according to POSIX. Since forkpty() is implemented in terms of fork(), those restrictions should apply to it too.
2021-02-07Don't implement Clone on Dir, SignalFd, and PtyMasterAlan Somers
Since they close their file descriptors on Drop, it's almost impossible to use Clone without creating a double-close situation. Also, check for EBADF in SignalFd::drop and Dir::drop.
2020-05-31Convert the crate to edition 2018Alan Somers
2020-04-21impl io::{Read,Write} for PtyMasterJosh Stone
`PtyMaster` acts like an owned file descriptor, even closing on `Drop`. Implementing `io::Read` and `io::Write` lets it be used directly in standard I/O operations.
2019-09-03Replace most instances of mem::uninitialized with mem::MaybeUninitAlan Somers
Only two instances remain: * For the deprecated sys::socket::CmsgSpace::new. We should probably just remove that method. * For sys::termios::Termios::default_uninit. This will require some more thought. Fixes #1096
2019-08-29Clippy cleanupAlan Somers
2019-06-09Add extra traits for all typesBryant Mairs
Derive Clone, Copy, Eq, Hash, and PartialEq for all types. Not all traits are supported by all types, which is why many are missing some.
2019-04-23pty: Add forkptyKevin Kuehler
2018-09-05Replace allow unused directive with _ prefixPascal Bach
2018-01-28Deny missing docs for pty moduleBryant Mairs
2018-01-28Require Debug impls for all typesBryant Mairs
2018-01-28Implement Copy/Clone for all types missing itBryant Mairs
2017-12-20Use backticks around types/functions in docsBryant Mairs
2017-12-20Remove unnecessary .into()Bryant Mairs
2017-12-04Stop reexporting `Errno` and its variantsJonas Schievink
cc #664 (unsure if this is everything needed)
2017-12-02Upgrade to Bitflags 1.0Bryant Mairs
The libc_bitflags! macro was replaced with a non-recursive one supporting only public structs. I could not figure out how to make the old macro work with the upgrade, so I reworked part of the bitflags! macro directly to suit our needs, much as the original recursive macro was made. There are no uses of this macro for non-public structs, so this is not a problem for internal code.
2017-10-08Replace most Linux man page links with Open Group man page linksAlan Somers
But leave in place Linux links for non-standard functions. Also, add brief docs for some functions that were lacking them.
2017-08-24Mark and document pty::ptsname() as unsafeNelson Chen
`ptsname()` mutates global variables and mutating global variables is always considered `unsafe` by Rust. Reference: https://github.com/nix-rust/nix/pull/742#issuecomment-324385919
2017-07-17Improve OpenptyResult documentationAlan Somers
2017-07-15PtyMaster::drop should panic on EBADFAlan Somers
Also, document the double-close risk with unistd::close Fixes #659
2017-07-10Use libc types for termiosBryant Mairs
This also removes the incorrect TCSASOFT definition as an enum type because it's actually a bitfield.
2017-06-12Add openpty()Kelvin Ly
2017-05-16Add various pty functionsBryant Mairs
* grantpt * ptsname/ptsname_r * posix_openpt * unlockpt