Skip to content

gavinhungry/shelby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

shelby

Issue commands to (and get responses from) a persistent shell. No dependencies.

Only tested with bash and csh/tcsh.

Installation

const Shelby = require('shelby');

Usage

let shell = new Shelby();

Constructor Options

  • path (String): absolute path to shell binary (default: /bin/sh)

  • timeout (Number): timeout (in ms) before shell exits with error (default: 0)

  • verbose (Boolean): if true, log all shell output to console (default: false)

  • logFile (String): absolute path to shell output log file (default: null)

  • onError (Function): callback function for all command errors (default: null)

Commands

await shell.run('uname'); // 'Linux'
await shell.run('FOOBAR=BAZ'); // null, no output
await shell.run('echo $FOOBAR'); // 'BAZ'
await shell.exit();

Command Options

  • timeout (Number): timeout (in ms) before command times out (default: 0)

  • wait (Boolean): if false, run command and ignore output, resolving immediately (default: true)

License

This software is released under the terms of the MIT license. See LICENSE.

About

Issue commands to (and get responses from) a persistent shell

Resources

License

Stars

Watchers

Forks

Packages

No packages published