This package has been deprecated

Author message:

Use child_process.execSync instead.

smash-shell

0.0.1 • Public • Published

smash-shell

A tiny shell command executor.

Install

执行 npm i --save smash-shellyarn add smash-shell 安装。

Usage

const Shell = require('smash-shell');
const cwd = path.normalize(path.resolve(__dirname, '.'));
const command = 'git log';
const options = {
    cwd,
    encoding: 'utf8',
    maxBuffer: 200 * 1024, // 200kb
};

// Shell.execSync
const { error, stdout } = Shell.execSync(command, options);
if (error) {
    console.log(error.message);
} else {
    console.log(stdout);
}

// Shell.exec
Shell.exec(command, options).then(({ error, stdout, stderr }) => {
    if (error) {
        console.log(error.message);
    } else {
        console.log(stdout);
    }
});

API

  1. Shell.execSync(command[, options])

  2. Shell.exec(command[, options])

Links

Package Sidebar

Install

npm i smash-shell

Weekly Downloads

4

Version

0.0.1

License

MIT

Unpacked Size

2.92 kB

Total Files

3

Last publish

Collaborators

  • erye