Passing password/otp via stdin

So as the title says, has anyone had success with this?

I store my ssh password in and do my otp secret generation with the pass, password manager.

I thought passing via stdin as such would work:
(pass Personal/teleport/password; pass otp Personal/teleport/2fa) | tsh login --proxy=proxy

However I get an error of “inappropriate ioctl for device.”

Given that tsh login ostensibly seems to take it’s input on stdin not sure why this is failing exactly. Planning to give it a look under strace and see if there’s not more redirection I need to do but I’d love if someone else has an answer. Thanks.

A bit of quick Googling seems to indicate that password prompts expect to read their input from a TTY and what you’re providing (standard input) is not actually a compatible TTY. You might look at using expect or something which is more designed for scripting input to programs.