runbash

0.0.9 • Public • Published
License Source —» Website npm
FPL github.com/cadorn/runbash CircleCI cadorn.github.io/runbash runbash

runbash

Run bash and bash.origin from NodeJS. Easily. Promise.

Usage

const RUNBASH = require("runbash");

Run Process .then resolve

RUNBASH([
    "echo 'Hello World'",       // Run a command
    "echo 'FOO: BAR'"           // Export a variable
], {                            // Defaults
    verbose: false,             // Log internal activity
    progress: false,            // Log process output
    wrappers: {                 // Setup environment before commands
        "bash.origin": true     // Load bash.origin
    },
    wait: true,                 // Resolve when process ends
    exports: false,             // Scan for /^<NAME>: <VALUE>$/
}).then(function (result) {
    
    // result.code ~ 0          // Process exit code
    // result.stdout ~ []
    // result.stderr ~ []
    // result.exports[<NAME>] ~ <VALUE>
 
    return null;
}).catch(console.error);

Start Process .then resolve

RUNBASH([], {
    wait: false
}).then(function (result) {
 
    // result.process ~ <Process Object>
    // result.killDeep()        // Kill process and spawned child processes
 
    return null;
}).catch(console.error);

Provenance

Original Source Logic under Free Public License by Christoph Dorn since 2015.

/runbash/

    Package Sidebar

    Install

    npm i runbash

    Weekly Downloads

    14

    Version

    0.0.9

    License

    none

    Unpacked Size

    12.9 kB

    Total Files

    6

    Last publish

    Collaborators

    • cadorn