npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

esc-get-interactive-cmd-result-async

v0.1.1

Published

async function that runs a shell command with arguments and environment variables, full interactive stdin/stdout/stderr usability (eg: run and use nano). Resolves/rejects with your command's return code.

Readme

esc-get-interactive-cmd-result-async

Run any terminal command fully interactively from Node.js. Inherit stdio so the user can interact live—perfect for editors, shells, debuggers, installers, prompts, and more.

  • Pure, dependency-free
  • Promisified, simple API
  • All stdio is live—for full interactive experience
  • Output & input visible to user, as if run from your shell

My other NPM modules for capturing output from passive commands

Capture stdout or get custom arrays on error afterwards

esc-get-cmd-stdout-array-promise

Capture std out/err with optional advanced easy capture/filtering, error handling, live output passthru

esc-get-cmd-data-passthru-async


Install

npm install esc-get-interactive-cmd-result-async

Usage

Run a command such as nano, bash, less, or anything needing live terminal I/O:

import { runInteractivelyP } from 'esc-get-interactive-cmd-result-async';

try {
  // Open nano for the user as if in a regular terminal
  const exitCode = await runInteractivelyP('nano', ['/tmp/foo.txt'], {
    env: { DEBUG: '1' },
    verbosity: 2,           // (0-3), default: 3
    // spawnO: { cwd: '/tmp' } // set custom spawn options if needed
  });
  console.log('Nano closed with exit code', exitCode);
} catch (exitCode) {
  console.error('Editor closed with error/exit code', exitCode);
}

Any command will run truly interactively—input and output happen live in your terminal.


API

runInteractivelyP(cmd, argsA=[], optionsO={})

  • cmd: String – Command to run (e.g. 'bash', 'nano', 'vim')
  • argsA: Array<string> – Arguments for the command.
  • optionsO: Object
    • env: Object (default: {}) – Extra environment variables (merged with process.env).
    • spawnO: Object – Extra child_process.spawn options (e.g., {cwd})
    • verbosity: 0-3 (default: 3)
      • 0: silent, 1: errors, 2: show commands, 3: show success
    • rejectOnError: Boolean (default: true) – Rejects promise on exit code != 0. If false, always resolves.

Returns

A Promise which resolves (or rejects) with the exit code.

  • 0 = success, non-zero = error/failure/other exit

Features

  • No dependencies
  • 100% interactive I/O stdin/stdout/stderr all passed through
  • Promisified
  • Live terminal experience
  • Custom env, cwd, spawn control
  • Small: Under 2k of code
  • Stable API
  • Simple

Typical Use

  • Interactive editors (nano, vim)
  • Running login shells, REPLs, or live CLIs with user prompts
  • Running full-screen UIs (e.g., top, htop)
  • Install scripts, password prompts, utilities that require input

License

MIT


Star it: esc-get-interactive-cmd-result-async on GitHub
Issues & PRs welcome!