rschmitt / heatseeker

A high-performance Selecta clone, written in Rust.
MIT License
214 stars 10 forks source link

Use `/usr/bin/env` to find `stty` #42

Open michaelpj opened 4 years ago

michaelpj commented 4 years ago

Some distros don't necessarily have stty at /bin/stty, but /usr/bin/env is slightly more standardized.

(I'd offer a patch but I'm currently a total Rust illiterate .)

rschmitt commented 4 years ago

Which distros, and where is it located if not /bin/stty? The /bin/stty path has been hard-coded due to https://github.com/rschmitt/heatseeker/issues/41.

michaelpj commented 4 years ago

NixOS in particular. It's on the PATH, but not in /bin. I realise this is slightly weird, but that's portability for you...

michaelpj commented 4 years ago

Oh I see, you specifically don't want to take it from the user's PATH. I can't really say anything to that except that I think that's quite fragile. If you need certain things to be installed and on the path then that's fine, and users need to get that right. Assuming you can get it from somewhere else seems risky (and does not work for me).

rschmitt commented 4 years ago

I may prefer /usr/bin/env to hardcoding /bin/stty now that I know that the latter isn't necessarily portable. I may also try both strategies.

michaelpj commented 4 years ago

To be clear, /usr/bin/env will do a PATH lookup, so the user in #41 would have the same problem due to having the wrong stty on their PATH.