'Silent commands should not generate an extra trailing blank line
After the move to interactive I/O, it was noticed that while run/sudo
commands which had non-empty stdout worked normally (consecutive such
commands were totally adjacent), those with no stdout (i.e. silent
commands like ``test`` or ``mkdir``) resulted in spurious blank lines
after the "run:" line. This looks quite ugly in real world scripts.'

@mock_streams('both')
@server(pubkeys=True, responses={'silent': '', 'normal': 'foo'})
def test_silent_commands_should_not_have_blank_line(self):

    env.password = None
    env.no_agent = env.no_keys = True
    env.key_filename = CLIENT_PRIVKEY
    with password_response(CLIENT_PRIVKEY_PASSPHRASE, silent=False):
        run('normal')
        run('silent')
        run('normal')
        with hide('everything'):
            run('normal')
            run('silent')
    expected = ("\n[%(prefix)s]    run:    normal\n[%(prefix)s]    Login    password    for    '%(user)s':    \n[%(prefix)s]    out:    foo\n[%(prefix)s]    run:    silent\n[%(prefix)s]    run:    normal\n[%(prefix)s]    out:    foo\n" % {'prefix': env.host_string, 'user': env.user})
    eq_(expected[1:], sys.stdall.getvalue())
