"...please don’t make the behavior of a command-line program depend on the type of output device it gets as standard output or standard input."
https://www.gnu.org/prep/standards/standards.html#User-Inter...
Of course you don't have to follow their standards, but their rationale for this particular item is reasonable.
I think a warning as described in the article is perhaps just about OK though.