Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

answer-prompt

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

answer-prompt

Answer prompts written to stderr or stdout.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Build Status npm version

answer-prompt

Answer prompt questions for easier scripting and test automation.

Install

npm install answer-prompt --save

Usage

Create a child process any way you which and pass it into answerPrompt. This will return a function that can be called to to answer questions.

var spawn = require("child_process").spawn;
var answerPrompt = require("answer-prompt");

var child = spawn("some_script.js");
var answer = answerPrompt(child, "stdout"); // 'stderr' also accepted

answer(/first name/, "Matthew\n");
answer(function(str){
  return str.trim() === "last name";
}, "Phillips\n");

answer(tester, response)

tester can be either a Function, a RegExp (probably most useful) or a String. answerPrompt will listen to stdout (default) or stderr and when a test passes write the response to stdin.

License

BSD 2 Clause

Keywords

FAQs

Package last updated on 09 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc