pstadler / flightplan

Run sequences of shell commands against local and remote hosts.
https://www.npmjs.com/package/flightplan
MIT License
1.82k stars 116 forks source link

Fix annoying "stdin: is not a tty" warning #32

Closed pstadler closed 8 years ago

pstadler commented 10 years ago

see also mitchellh/vagrant/issues/1673

voleoo commented 10 years ago

Also have this problem in MacOS 10.9.4

pstadler commented 10 years ago

Are you connecting to an Ubuntu host?

voleoo commented 10 years ago

yes, precise64.box

pstadler commented 10 years ago

Probably the only good solution is to edit /root/.profile and replace mesg n with tty -s && mesg n. See here: https://github.com/mitchellh/vagrant/issues/1673#issuecomment-24404605

voleoo commented 10 years ago

Thanks

mscdex commented 9 years ago

FWIW ssh2 supports requesting a pty when executing commands. That may help get around this message.

pstadler commented 9 years ago

@mscdex, thanks for the hint and for doing all the hard work that makes this project here possible. I know about the PTY option but I'm a bit afraid that enabling it might leads to unexpected behavior and confusion when multiple hosts are asking for user input at the same time. If you've got the time, let me what you think.

mscdex commented 9 years ago

@pstadler I'm not sure what you mean by "confusion when multiple hosts are asking for user input at the same time." Each exec() has its own stream and would have its own pty on the remote side.

pstadler commented 9 years ago

stdin is still shared. That means both processes would print the user input at the same time, things like that.

mscdex commented 9 years ago

Requesting a pty on the remote side should not affect the stdin of the local system or anything like that. It's only asking the remote server to request a new pty for that particular command on the remote side.

stream is still just the same plain old stream as before. The only difference is that whatever command you're executing remotely will think it's being run inside a real terminal, so programs like sudo will actually prompt you for a password and things like that instead of ordinarily just outright failing when sudo or whatever program does not detect a tty.

pstadler commented 9 years ago

Flightplan executes tasks on remote hosts in parallel which means that multiple hosts might ask for user input at the same time and all the sessions will receive the same input.

Correct me if I'm wrong, but there's no event being triggered when a remote host asks for user input, right? The ultimate solution would be to capture stdin and send it to the first host asking for user input, then the next, and so on.

Anyway, I will look into this as soon as possible and post the results here.