mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-12 10:52:47 +00:00
32 lines
658 B
JavaScript
32 lines
658 B
JavaScript
/*
|
|
* index.js: Test helpers for forever.
|
|
*
|
|
* (C) 2015 Charlie Robbins & the Contributors
|
|
* MIT LICENCE
|
|
*
|
|
*/
|
|
|
|
var path = require('path'),
|
|
spawn = require('child_process').spawn;
|
|
|
|
/*
|
|
* function runCmd (cmd, args)
|
|
* Executes forever with the `cmd` and arguments.
|
|
*/
|
|
exports.runCmd = function runCmd(cmd, args) {
|
|
var proc = spawn(process.execPath, [
|
|
path.resolve(__dirname, '../../', 'bin/forever'),
|
|
cmd
|
|
].concat(args), {detached: true});
|
|
|
|
//
|
|
// Pipe everything to `stderr` so it can
|
|
// be seen when running `npm test`.
|
|
//
|
|
proc.stdout.pipe(process.stderr);
|
|
proc.stderr.pipe(process.stderr);
|
|
|
|
proc.unref();
|
|
return proc;
|
|
}
|