steelbrain / steelbrain/node-ssh
Endless read
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1k
- Forks
- 94
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I'm trying to open the shell which writes a command to the host and gets endless push updates.
In command-line it will be like:
~> ssh {user}@{host} -p{port} -T -i {private key path}
~>
~> -- pushed from the host side
~> .....
While trying to do so with your package, like,
const { NodeSSH } = require('node-ssh')
const client = new NodeSSH()
function wait(delay) {
return new Promise(function (resolve) {
setTimeout(resolve, delay)
})
}
var intcommand = JSON.stringify({ ... })
client.connect({
host: {host},
port: {port},
username: {username},
privateKey: {private key path}
})
.then(async function () {
const data = []
const shell = await client.requestShell()
shell.on('data', function (chunk) {
console.log(chunk.toString('utf8'));
data.push(chunk.toString('utf8'))
})
shell.write(intcommand)
await wait(50)
shell.end(cb=>{
console.log('shell ended: ', cb == undefined?'':cb);
})
})
Now.
It retrieves the first raw and close.
How can I push my request to the host and keep it open to consume the endless pushed feed?
it seems that it works only while write the command and call end.
What am I missing here?
Please advise
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test is named. Start by tracing requestShell and the shell stream lifecycle, then reproduce the example with and without shell.end; done means establishing whether endless pushed output is supported and documenting or correcting the observed behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100