respawner.js 448 B

1234567891011121314151617
  1. #!/usr/bin/env node
  2. const flaggedRespawn = require('../../');
  3. // get a list of all possible v8 flags for the running version of node
  4. const v8flags = require('v8flags').fetch();
  5. flaggedRespawn(v8flags, process.argv, function (ready, child) {
  6. if (ready) {
  7. console.log('Running!');
  8. } else {
  9. console.log('Special flags found, respawning.');
  10. }
  11. if (child.pid !== process.pid) {
  12. console.log('Respawned to PID:', child.pid);
  13. }
  14. });