Fixed a bug - no panic anymore when logining in without TTY

Fixes #8956

Signed-off-by: Marianna <mtesselh@gmail.com>
I think all code until `cmd.Run` can be just `cmd.Stdin = bytes.NewBufferString("buffer test string \n")`