You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
lettimerID=setTimeout(()=>{console.log('sorry the timeout')},5000)ssh.execCommand('echo hello',{cwd:'/'}).then((result)=>{console.log('nice, we got peer command output'+result.stdout)}).catch((err)=>{console.log('something error')}).finally(()=>{clearTimeout(timerID)timerID=null})
Thanks for writing in. Since this library is a wrapper around the ssh2 package, it supports the same features.
If you are using the exec or execCommand functions, it's not possible (as per my current knowledge) to issue an abort command. But depending on your usecase, you should be able to use the requestShell function, and invoke the command in the shell. Inside the shell, you can send various signals like ctrl-c through stdin.
If the commands you are executing are non consequential, you can do what @zydingjun recommended above and have a timeout in your local code
helllo.
i like node-ssh and i am using this library in our project.
I have a question about timeout.
when i use "execCommand" or "exec", how to set timeout ?
if i want to wait just 5 sec, how to set ?
The text was updated successfully, but these errors were encountered: