on-internet
← Community

Detecting input prompts from SSH2 commands

Stack Overflow ·

How can we detect a remote input prompt after executing an SSH2 command? At first, I was sure to just handle data event on the stream.stdin, but I found through testing that it is not the case, and the handler gets notifications even when there is no input prompt of any kind. import {Client as SSH2Client} from 'ssh2'; function executeCommand(client: SSH2Client, cmd: string) { client.exec(cmd, (err, stream) => { stream.stdin.on('data', (chunk: Buffer) => { // why is it called when there is no input prompt? }); }); } But if this doesn't work, then how else can we detect input prompts? Normal (no

Comments

Sign in or sign up to comment and upvote.

No comments yet.