jprichardson / jprichardson/node-suppose

How to use regular expressions in “when”

Open
#24 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

const suppose = require("suppose");
suppose('sudo',['rm','-rf','123'])
    .when(/password/).respond('123456\n')
    .on('error',function(err){
        console.log(err.message);
    })
    .end(function(code){
        console.log(code);

    })

But it did not delete.

my message is:
[sudo] password for black-hole:

How should I write?

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 shown suppose command and inspect how the when(/password/) call handles the complete sudo prompt. Compare the observed prompt and callback behavior with the package's documented usage, then clarify the correct regular-expression form and what output confirms the command completed.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.