jprichardson / jprichardson/node-suppose

Only first .respond() is sent to stdin to external program

Open
#20 5 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

Hi and thank you very much for this great package!

I am trying to communicate with external program (compiled go to exe binary) on windows (7, x64) from my node script as follows:

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

suppose('program.exe', ['--create'], {debug: fs.createWriteStream('debug.txt')})
    .when('Question one: ').respond('1234567\n')
    .when('Ouestion two (n/no/y/yes) [no]:' ).respond('n\n')
    .when('Question three (n/no/y/yes) [no]: ' ).respond('n\n')
    .on('error', function(err){
        console.log(err.message);
    })
    .end(function(code){
            console.log('end method called - code '+code.toString()); 
     })

But I never get the program (exe) to output "Question two...". Only first output-response work. Here is my debug.txt:

program.exe --create
-----------------------
Question one: 1234567

Node script terminal outputs: end method called - code 1

Please help me with what am I doing wrong here ?
Thank you very much in advance for your help&reply.

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 with the suppose('program.exe', ['--create'], ...) invocation and the chained when/respond handlers shown in the issue. Reproduce the Windows interaction using the debug output, then trace why processing stops after the first response. Done means the external program reaches the second and third prompts and receives their responses.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
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.