jprichardson / jprichardson/node-suppose

Argh what am i doing wrong?

Open
#44 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
255
Forks
23
PR merge metrics
No merged PRs in 30d

Description

Sorry, this is likely a dumb question but all I'm trying to do here is simply telnet into a device. My console.log at the end is continually returning undefined and the debug.txt never has anything in it. I've also noticed that when i use .on instead of .when (for the expect statements) i actually get some kind of output although it's an error. Using .when gives me nothing. Im using suppose version 0.6.2. Any idea where I'm being dumb here?

const suppose = require('suppose');
const fs = require('fs')

suppose('telnet' ['10.0.0.91'],{ debug: fs.createWriteStream('/tmp/debug.txt') })
.when('login:').respond('admin\n')
.when('Password:').respond('password')
 .on('error', function(err){
    console.log(err.message);
 })
    .end(function(code) {
        console.log(code);
    });

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the suppose 0.6.2 telnet example with the shown .when/.respond chain, the .on error handler, and the debug stream. Compare the .when and .on behavior; done means the session reaches the prompts, writes debug.txt, and reports a completion code or a clear error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.