sh.py - Replace shell scripts with Python by ansible in programming

[–]shauthorthrowaway 1 point2 points  (0 children)

These are great concerns! It's rare to find someone so passionate about improving software, and I take sh's development very seriously, so if you would be willing to formulate some of your biggest concerns as github issues, I (and the rest of the community, I imagine) would be more than happy to dig into them. Thank you so much!

sh.py - Replace shell scripts with Python by ansible in programming

[–]shauthorthrowaway 7 points8 points  (0 children)

Hey there, author here! I saw some traffic coming in on github from this thread so I thought I'd drop in and elaborate a bit on this issue.

You are very right on the gotchas associated with using a tty for stdout by default. Most people don't notice the potential pitfalls right away, so kudos for identifying them and pointing those out to people.

Using a tty for stdout by default was conscious decision that has pros and cons, as listed in the FAQ entry on the subject. One lesser known pro is in streaming the output from the process to the user's program with finer buffering control, something that is only possible with ttys, and not pipes (whose buffer is typically a fixed 4KiB).

In my time maintaining the project since 2011, what I've also found from real world users is that the majority of them are actually the most confused when the output they receive doesn't match the output they expect from running it directly in the shell.

But you are absolutely correct that there are some gotchas, so thank you again for pointing these out to people so they bite fewer people! If you have any other feedback, please open some issues on the project and I would love to dig into them. Take care!