Initial commit
[yaffs-website] / node_modules / flagged-respawn / index.js
1 const reorder = require('./lib/reorder');
2 const respawn = require('./lib/respawn');
3
4 module.exports = function (flags, argv, execute) {
5   if (!flags) {
6     throw new Error('You must specify flags to respawn with.');
7   }
8   if (!argv) {
9     throw new Error('You must specify an argv array.');
10   }
11   var proc = process;
12   var reordered = reorder(flags, argv);
13   var ready = JSON.stringify(argv) === JSON.stringify(reordered);
14   if (!ready) {
15     proc = respawn(reordered);
16   }
17   execute(ready, proc);
18 };