andfoy / winpty-rs

Create and spawn processes inside a pseudoterminal in Windows from Rust
Other
23 stars 7 forks source link

Feature request: method to kill the pty and the underline process. #67

Closed Tnze closed 10 months ago

Tnze commented 11 months ago

I'm trying to map the api of this crate to the same as https://github.com/microsoft/node-pty, and wandering there is a way to kill the pty.

Thank you!

andfoy commented 10 months ago

Hi @Tnze, thanks for reaching out! The API design is currently designed to kill the PTY object once is dropped, this ensures that no "dead" PTY objects are left behind, and thus no additional cases where a PTY has not started yet are considered. Also, spawning a new process from a PTY that stopped running a process previously is not permitted, since recycling objects is not allowed.

For your use case, deleting the object or rewriting it should suffice to finish a process.