thefrontside / ctrlc-windows

Send a CTRL-C event to a Windows console application
9 stars 2 forks source link

Convert to more idiomatic Rust #1

Closed jnicklas closed 3 years ago

jnicklas commented 4 years ago

It's been so long since I wrote some Rust code, so I just had to dig into this a bit. I tried to clean this up a bit, primarily by reducing the scope of the unsafe blocks. One thing that is a bit silly is that there are three ctrlc functions, this definitely made handling errors easier, but their naming is a bit silly.

Also, I don't actually have windows, so I'm unable to run this to verify whether this actually works 😅 I was able to set up windows cross compilation, and this does compile successfully.

cowboyd commented 4 years ago

This is very nice, but it doesn't seem to work 😭 😭

I'm working on some tests for this as we speak

cowboyd commented 4 years ago

@jnicklas now that we have a test suite with #3 and the much simpler "killer" strategy implemented, a review of the rust style will be a lot easier to validate.