asyncssh icon indicating copy to clipboard operation
asyncssh copied to clipboard

Unable to run commands in sequence.

Open mukkid opened this issue 2 months ago • 1 comments

Hello! I am trying to run commands against a Cisco network device in series using something like this

with asyncssh.connect(MY_HOST) as conn:
    cmds = ['show version', 'show arp']
    for cmd in cmds:
        out = await conn.run(cmd)
        print(out.stdout)

But when I run it, the channel seems to be closed after the first command finishes.

'Proper version info here........'

ChannelOpenError('')

Am I missing something painfully obvious or do you think it's something to do with the network device? For what it's worth, I don't see this issue when using paramiko though that doesn't get me the async capabilities. Curiously, I can get it to work using scrapli using asyncssh as the backend, but I'd rather use this library standalone. Any input is appreciated. Thank you!

mukkid avatar Oct 03 '25 03:10 mukkid