A Rust library for automating and controlling interactive terminal applications via pseudo-terminals.
Expectrl is a Rust library for automating interactive terminal applications by spawning child processes and controlling them through simulated user input and output pattern matching. It solves the problem of automating command-line interactions that require human-like responses to prompts and dynamic output, similar to the classic Expect tool. The library provides a safe and performant way to script terminal sessions within Rust applications.
Rust developers who need to automate interactive command-line tools, test terminal-based applications, or integrate with legacy systems requiring scripted terminal interactions. It is particularly useful for DevOps engineers, QA testers, and system administrators building automation scripts in Rust.
Developers choose Expectrl over alternatives because it brings the proven Expect pattern-matching automation paradigm to Rust with native safety, cross-platform support (including Windows), and optional async capabilities. Its unique selling point is combining the reliability of Expect-style automation with Rust's performance and memory safety guarantees.
A rust library for controlling interactive programs in a pseudo-terminal
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Works on Windows, Linux, and Unix-like systems, as stated in the README, ensuring broad compatibility for terminal automation across environments.
Supports both string and regex-based expectations, enabling precise response to terminal output patterns, similar to the classic Expect tool.
Optional asynchronous feature allows non-blocking automation, useful for handling multiple interactive processes concurrently without blocking threads.
Integrated logging support facilitates debugging by recording entire automation sessions, as highlighted in the features list.
For basic process control without interaction, the API can be more complex than necessary compared to standard Rust process libraries like std::process.
Setting up correct pattern matching for complex interactive sequences requires careful testing and can lead to subtle bugs if patterns are misaligned.
As a Rust-specific library, it has fewer community examples and resources compared to established tools like Expect in Python or other languages.