{"maintainers":[{"name":"tkellen","email":"tyler@sleekcode.net"},{"name":"tusbar","email":"b@pk.am"}],"keywords":["respawn flags"],"dist-tags":{"latest":"0.3.2"},"author":{"name":"Tyler Kellen","url":"http://goingslowly.com/"},"description":"A tool for respawning node binaries when special flags are present.","readme":"# flagged-respawn [![Build Status](https://secure.travis-ci.org/js-cli/js-flagged-respawn.svg)](http://travis-ci.org/js-cli/js-flagged-respawn)\n> A tool for respawning node binaries when special flags are present.\n\n[![NPM](https://nodei.co/npm/flagged-respawn.png)](https://nodei.co/npm/flagged-respawn/)\n\n## What is it?\n\nSay you wrote a command line tool that runs arbitrary javascript (e.g. task runner, test framework, etc). For the sake of discussion, let's pretend it's a testing harness you've named `testify`.\n\nEverything is going splendidly until one day you decide to test some code that relies on a feature behind a v8 flag in node (`--harmony`, for example).  Without much thought, you run `testify --harmony spec tests.js`.\n\nIt doesn't work. After digging around for a bit, you realize this produces a [`process.argv`](http://nodejs.org/docs/latest/api/process.html#process_process_argv) of:\n\n`['node', '/usr/local/bin/test', '--harmony', 'spec', 'tests.js']`\n\nCrap. The `--harmony` flag is in the wrong place! It should be applied to the **node** command, not our binary. What we actually wanted was this:\n\n`['node', '--harmony', '/usr/local/bin/test', 'spec', 'tests.js']`\n\nFlagged-respawn fixes this problem and handles all the edge cases respawning creates, such as:\n- Providing a method to determine if a respawn is needed.\n- Piping stderr/stdout from the child into the parent.\n- Making the parent process exit with the same code as the child.\n- If the child is killed, making the parent exit with the same signal.\n\nTo see it in action, clone this repository and run `npm install` / `npm run respawn` / `npm run nospawn`.\n\n## Sample Usage\n\n```js\n#!/usr/bin/env node\n\nconst flaggedRespawn = require('flagged-respawn');\n\n// get a list of all possible v8 flags for the running version of node\nconst v8flags = require('v8flags').fetch();\n\nflaggedRespawn(v8flags, process.argv, function (ready, child) {\n  if (ready) {\n    console.log('Running!');\n    // your cli code here\n  } else {\n    console.log('Special flags found, respawning.');\n  }\n  if (process.pid !== child.pid) {\n    console.log('Respawned to PID:', child.pid);\n  }\n});\n\n```\n\n## Release History\n\n* 2016-03-22 - v0.3.2 - fix issue with v8 flags values being dropped\n* 2014-09-12 - v0.3.1 - use `{ stdio: 'inherit' }` for spawn to maintain colors\n* 2014-09-11 - v0.3.0 - for real this time\n* 2014-09-11 - v0.2.0 - cleanup\n* 2014-09-04 - v0.1.1 - initial release\n","repository":{"type":"git","url":"git://github.com/js-cli/js-flagged-respawn.git"},"bugs":{"url":"https://github.com/js-cli/js-flagged-respawn/issues"},"versions":{"0.1.0":{"name":"flagged-respawn","description":"A tool for respawning node binaries when special flags are present.","version":"0.1.0","homepage":"https://github.com/tkellen/node-flagged-respawn","author":{"name":"Tyler Kellen","url":"http://goingslowly.com/"},"repository":{"type":"git","url":"git://github.com/tkellen/node-flagged-respawn.git"},"bugs":{"url":"https://github.com/tkellen/node-flagged-respawn/issues"},"licenses":[{"type":"MIT","url":"https://github.com/tkellen/node-flagged-respawn/blob/master/LICENSE"}],"scripts":{"respawn":"node bin/example --harmony test","nospawn":"node bin/example test","test":"mocha -R spec test.js"},"main":"index.js","engines":{"node":">= 0.8.0"},"keywords":["respawn flags"],"devDependencies":{"chai":"^1.9.1","mocha":"^1.21.4","v8flags":"^1.0.1"},"_id":"flagged-respawn@0.1.0","_shasum":"25aa6592c36ff63b451984961c543c42da30a095","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"tkellen","email":"tyler@sleekcode.net"},"maintainers":[{"name":"tkellen","email":"tyler@sleekcode.net"}],"dist":{"shasum":"25aa6592c36ff63b451984961c543c42da30a095","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/flagged-respawn/-/flagged-respawn-0.1.0.tgz"},"directories":{}},"0.1.1":{"name":"flagged-respawn","description":"A tool for respawning node binaries when special flags are present.","version":"0.1.1","homepage":"https://github.com/tkellen/node-flagged-respawn","author":{"name":"Tyler Kellen","url":"http://goingslowly.com/"},"repository":{"type":"git","url":"git://github.com/tkellen/node-flagged-respawn.git"},"bugs":{"url":"https://github.com/tkellen/node-flagged-respawn/issues"},"licenses":[{"type":"MIT","url":"https://github.com/tkellen/node-flagged-respawn/blob/master/LICENSE"}],"scripts":{"respawn":"node bin/example --harmony test","nospawn":"node bin/example test","test":"mocha -R spec test.js"},"main":"index.js","engines":{"node":">= 0.8.0"},"keywords":["respawn flags"],"devDependencies":{"chai":"~1.9.1","mocha":"~1.21.4","v8flags":"~1.0.1"},"_id":"flagged-respawn@0.1.1","_shasum":"cac24e4f36985affb9bded25d453067c230d4e1d","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"tkellen","email":"tyler@sleekcode.net"},"maintainers":[{"name":"tkellen","email":"tyler@sleekcode.net"}],"dist":{"shasum":"cac24e4f36985affb9bded25d453067c230d4e1d","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/flagged-respawn/-/flagged-respawn-0.1.1.tgz"},"directories":{}},"0.1.2":{"name":"flagged-respawn","description":"A tool for respawning node binaries when special flags are present.","version":"0.1.2","homepage":"https://github.com/tkellen/node-flagged-respawn","author":{"name":"Tyler Kellen","url":"http://goingslowly.com/"},"repository":{"type":"git","url":"git://github.com/tkellen/node-flagged-respawn.git"},"bugs":{"url":"https://github.com/tkellen/node-flagged-respawn/issues"},"licenses":[{"type":"MIT","url":"https://github.com/tkellen/node-flagged-respawn/blob/master/LICENSE"}],"scripts":{"respawn":"node bin/example --harmony test","nospawn":"node bin/example test","test":"mocha -R spec test.js"},"main":"index.js","engines":{"node":">= 0.8.0"},"keywords":["respawn flags"],"devDependencies":{"chai":"~1.9.1","mocha":"~1.21.4","v8flags":"~1.0.1"},"_id":"flagged-respawn@0.1.2","_shasum":"93e9511322e01d39cad398c6403da998b9d259ac","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"tkellen","email":"tyler@sleekcode.net"},"maintainers":[{"name":"tkellen","email":"tyler@sleekcode.net"}],"dist":{"shasum":"93e9511322e01d39cad398c6403da998b9d259ac","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/flagged-respawn/-/flagged-respawn-0.1.2.tgz"},"directories":{}},"0.2.0":{"name":"flagged-respawn","description":"A tool for respawning node binaries when special flags are present.","version":"0.2.0","homepage":"https://github.com/tkellen/node-flagged-respawn","author":{"name":"Tyler Kellen","url":"http://goingslowly.com/"},"repository":{"type":"git","url":"git://github.com/tkellen/node-flagged-respawn.git"},"bugs":{"url":"https://github.com/tkellen/node-flagged-respawn/issues"},"licenses":[{"type":"MIT","url":"https://github.com/tkellen/node-flagged-respawn/blob/master/LICENSE"}],"scripts":{"respawn":"node test/bin/respawner --harmony test","nospawn":"node test/bin/respawner test","test":"mocha -R spec test"},"main":"index.js","engines":{"node":">= 0.8.0"},"keywords":["respawn flags"],"devDependencies":{"chai":"~1.9.1","mocha":"~1.21.4","v8flags":"~1.0.1"},"_id":"flagged-respawn@0.2.0","_shasum":"e5255fa8beb878266ae9bb0e75c982046dafe886","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"tkellen","email":"tyler@sleekcode.net"},"maintainers":[{"name":"tkellen","email":"tyler@sleekcode.net"}],"dist":{"shasum":"e5255fa8beb878266ae9bb0e75c982046dafe886","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/flagged-respawn/-/flagged-respawn-0.2.0.tgz"},"directories":{}},"0.3.0":{"name":"flagged-respawn","description":"A tool for respawning node binaries when special flags are present.","version":"0.3.0","homepage":"https://github.com/tkellen/node-flagged-respawn","author":{"name":"Tyler Kellen","url":"http://goingslowly.com/"},"repository":{"type":"git","url":"git://github.com/tkellen/node-flagged-respawn.git"},"bugs":{"url":"https://github.com/tkellen/node-flagged-respawn/issues"},"licenses":[{"type":"MIT","url":"https://github.com/tkellen/node-flagged-respawn/blob/master/LICENSE"}],"scripts":{"respawn":"node test/bin/respawner --harmony test","nospawn":"node test/bin/respawner test","test":"mocha -R spec test"},"main":"index.js","engines":{"node":">= 0.8.0"},"keywords":["respawn flags"],"devDependencies":{"chai":"~1.9.1","mocha":"~1.21.4","v8flags":"~1.0.1"},"_id":"flagged-respawn@0.3.0","_shasum":"28bc5824f922d062fc528896b369eb1697fab331","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"tkellen","email":"tyler@sleekcode.net"},"maintainers":[{"name":"tkellen","email":"tyler@sleekcode.net"}],"dist":{"shasum":"28bc5824f922d062fc528896b369eb1697fab331","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/flagged-respawn/-/flagged-respawn-0.3.0.tgz"},"directories":{}},"0.3.1":{"name":"flagged-respawn","description":"A tool for respawning node binaries when special flags are present.","version":"0.3.1","homepage":"https://github.com/tkellen/node-flagged-respawn","author":{"name":"Tyler Kellen","url":"http://goingslowly.com/"},"repository":{"type":"git","url":"git://github.com/tkellen/node-flagged-respawn.git"},"bugs":{"url":"https://github.com/tkellen/node-flagged-respawn/issues"},"licenses":[{"type":"MIT","url":"https://github.com/tkellen/node-flagged-respawn/blob/master/LICENSE"}],"scripts":{"respawn":"node test/bin/respawner --harmony test","nospawn":"node test/bin/respawner test","test":"mocha -R spec test"},"main":"index.js","engines":{"node":">= 0.8.0"},"keywords":["respawn flags"],"devDependencies":{"chai":"~1.9.1","mocha":"~1.21.4","v8flags":"~1.0.1"},"gitHead":"67f84fdd7b5f236f24ab9beee9ed1f5bf7ca8778","_id":"flagged-respawn@0.3.1","_shasum":"397700925df6e12452202a71e89d89545fbbbe9d","_from":".","_npmVersion":"1.4.26","_npmUser":{"name":"tkellen","email":"tyler@sleekcode.net"},"maintainers":[{"name":"tkellen","email":"tyler@sleekcode.net"}],"dist":{"shasum":"397700925df6e12452202a71e89d89545fbbbe9d","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/flagged-respawn/-/flagged-respawn-0.3.1.tgz"},"directories":{}},"0.3.2":{"name":"flagged-respawn","description":"A tool for respawning node binaries when special flags are present.","version":"0.3.2","homepage":"https://github.com/js-cli/js-flagged-respawn","author":{"name":"Tyler Kellen","url":"http://goingslowly.com/"},"repository":{"type":"git","url":"git://github.com/js-cli/js-flagged-respawn.git"},"bugs":{"url":"https://github.com/js-cli/js-flagged-respawn/issues"},"licenses":[{"type":"MIT","url":"https://github.com/js-cli/js-flagged-respawn/blob/master/LICENSE"}],"scripts":{"respawn":"node test/bin/respawner --harmony test","nospawn":"node test/bin/respawner test","test":"mocha -R spec test"},"main":"index.js","engines":{"node":">= 0.8.0"},"keywords":["respawn flags"],"devDependencies":{"chai":"~1.9.1","mocha":"~1.21.4","v8flags":"~1.0.1"},"gitHead":"5467529adb5512292c8dd341691ba75b2293ed7e","_id":"flagged-respawn@0.3.2","_shasum":"ff191eddcd7088a675b2610fffc976be9b8074b5","_from":".","_npmVersion":"2.14.9","_nodeVersion":"0.12.12","_npmUser":{"name":"tusbar","email":"b@pk.am"},"maintainers":[{"name":"tkellen","email":"tyler@sleekcode.net"},{"name":"tusbar","email":"b@pk.am"}],"dist":{"shasum":"ff191eddcd7088a675b2610fffc976be9b8074b5","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/flagged-respawn/-/flagged-respawn-0.3.2.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/flagged-respawn-0.3.2.tgz_1458638775261_0.252670707879588"},"directories":{}}},"name":"flagged-respawn","time":{"modified":"2016-03-22T09:26:17.440Z","created":"2014-09-04T07:44:33.190Z","0.1.0":"2014-09-04T07:44:33.190Z","0.1.1":"2014-09-04T07:46:08.122Z","0.1.2":"2014-09-04T17:17:38.651Z","0.2.0":"2014-09-11T14:55:26.359Z","0.3.0":"2014-09-11T16:11:59.568Z","0.3.1":"2014-09-12T16:11:17.435Z","0.3.2":"2016-03-22T09:26:17.440Z"},"readmeFilename":"README.md","homepage":"https://github.com/js-cli/js-flagged-respawn"}