2.0.2 • Published 5 years ago

yexec v2.0.2

Weekly downloads
5
License
ISC
Repository
github
Last release
5 years ago

yexec

Build Status Coverage Status

Yet another process execution wrapper. Uses child_process.spawn to execute an external process and capture stdout and stderr.

  • Logs stdout and stderr to a logger implementation of your choice as long as it supports the standard level functions like info, warn, and error.
  • Supports optional log filter
  • Protects against double callbacks from error and exit events.
  • Throws an Error if process exits with non-zero code
  • Specify an optional timeout. If the process has not exited within the interval the process is force killed and a TIMEOUT error is thrown.

Usage

npm install yexec
var yexec = require('yexec');
var winston = require('winston');

var params = {
  executable: 'git',
  args: ['clone', 'https://github.com/nodejs/node.git'],
  logger: winston,
  timeout: 5000, // 5 seconds
  logFilter: function(level, msg) {
    return level !== 'info';
  }
};

try {
  await yexec(params);
} catch (err) {
  // If timeout occurred, err.code will be 'TIMEOUT'
  winston.error('Oops, git failed with code %s', err.code);
}
2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.1.2

7 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago