aboutsummaryrefslogtreecommitdiff
path: root/node_modules/flagged-respawn
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/flagged-respawn')
-rw-r--r--node_modules/flagged-respawn/LICENSE22
-rw-r--r--node_modules/flagged-respawn/README.md93
-rw-r--r--node_modules/flagged-respawn/index.js52
-rw-r--r--node_modules/flagged-respawn/lib/reorder.js18
-rw-r--r--node_modules/flagged-respawn/lib/respawn.js16
-rw-r--r--node_modules/flagged-respawn/package.json44
6 files changed, 0 insertions, 245 deletions
diff --git a/node_modules/flagged-respawn/LICENSE b/node_modules/flagged-respawn/LICENSE
deleted file mode 100644
index a55f5b74b..000000000
--- a/node_modules/flagged-respawn/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) 2014 Tyler Kellen
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/flagged-respawn/README.md b/node_modules/flagged-respawn/README.md
deleted file mode 100644
index a281f0806..000000000
--- a/node_modules/flagged-respawn/README.md
+++ /dev/null
@@ -1,93 +0,0 @@
-# flagged-respawn [![Build Status](https://secure.travis-ci.org/js-cli/js-flagged-respawn.svg)](http://travis-ci.org/js-cli/js-flagged-respawn)
-> A tool for respawning node binaries when special flags are present.
-
-[![NPM](https://nodei.co/npm/flagged-respawn.png)](https://nodei.co/npm/flagged-respawn/)
-
-## What is it?
-
-Say 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`.
-
-Everything 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`.
-
-It 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:
-
-`['node', '/usr/local/bin/test', '--harmony', 'spec', 'tests.js']`
-
-Crap. 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:
-
-`['node', '--harmony', '/usr/local/bin/test', 'spec', 'tests.js']`
-
-Flagged-respawn fixes this problem and handles all the edge cases respawning creates, such as:
-- Providing a method to determine if a respawn is needed.
-- Piping stderr/stdout from the child into the parent.
-- Making the parent process exit with the same code as the child.
-- If the child is killed, making the parent exit with the same signal.
-
-To see it in action, clone this repository and run `npm install` / `npm run respawn` / `npm run nospawn`.
-
-## Sample Usage
-
-```js
-#!/usr/bin/env node
-
-const flaggedRespawn = require('flagged-respawn');
-
-// get a list of all possible v8 flags for the running version of node
-const v8flags = require('v8flags').fetch();
-
-flaggedRespawn(v8flags, process.argv, function (ready, child) {
- if (ready) {
- console.log('Running!');
- // your cli code here
- } else {
- console.log('Special flags found, respawning.');
- }
- if (process.pid !== child.pid) {
- console.log('Respawned to PID:', child.pid);
- }
-});
-
-```
-
-
-## API
-
-### <u>flaggedRespawn(flags, argv, [ forcedFlags, ] callback) : Void</u>
-
-Respawns the script itself when *argv* has special flag contained in *flags* and/or *forcedFlags* is not empty. Because members of *flags* and *forcedFlags* are passed to `node` command, each of them needs to be a node flag or a V8 flag.
-
-#### Forbid respawning
-
-If `--no-respawning` flag is given in *argv*, this function does not respawned even if *argv* contains members of flags or *forcedFlags* is not empty. (This flag is also used internally to prevent from respawning more than once).
-
-#### Parameter:
-
-| Parameter | Type | Description |
-|:--------------|:------:|:----------------------------------------------------|
-| *flags* | Array | An array of node flags and V8 flags which are available when present in *argv*. |
-| *argv* | Array | Command line arguments to respawn. |
-| *forcedFlags* | Array or String | An array of node flags or a string of a single flag and V8 flags for respawning forcely. |
-| *callback* | function | A called function when not respawning or after respawned. |
-
-* **<u><i>callback</i>(ready, proc, argv) : Void</u>**
-
- *callback* function is called both when respawned or not, and it can be distinguished by callback's argument: *ready*. (*ready* indicates whether a process spawned its child process (false) or not (true), but it does not indicate whether a process is a spawned child process or not. *ready* for a spawned child process is true.)
-
- *argv* is an array of command line arguments which is respawned (when *ready* is false) or is passed current process except flags within *flags* and `--no-respawning` (when *ready* is true).
-
- **Parameter:**
-
- | Parameter | Type | Description |
- |:----------|:-------:|:--------------------------|
- | *ready* | boolean | True, if not respawning and is ready to execute main function. |
- | *proc* | object | Child process object if respawned, otherwise current process object. |
- | *argv* | Array | An array of command line arguments. |
-
-## Release History
-
-* 2017-12-16 - v1.0.0 - Force/Forbid respawn, Improved API & testing
-* 2016-03-22 - v0.3.2 - fix issue with v8 flags values being dropped
-* 2014-09-12 - v0.3.1 - use `{ stdio: 'inherit' }` for spawn to maintain colors
-* 2014-09-11 - v0.3.0 - for real this time
-* 2014-09-11 - v0.2.0 - cleanup
-* 2014-09-04 - v0.1.1 - initial release
diff --git a/node_modules/flagged-respawn/index.js b/node_modules/flagged-respawn/index.js
deleted file mode 100644
index 15b4bf70d..000000000
--- a/node_modules/flagged-respawn/index.js
+++ /dev/null
@@ -1,52 +0,0 @@
-const reorder = require('./lib/reorder');
-const respawn = require('./lib/respawn');
-const remover = require('./lib/remover');
-
-const FORBID_RESPAWNING_FLAG = '--no-respawning';
-
-module.exports = function (flags, argv, forcedFlags, execute) {
- if (!flags) {
- throw new Error('You must specify flags to respawn with.');
- }
- if (!argv) {
- throw new Error('You must specify an argv array.');
- }
-
- if (typeof forcedFlags === 'function') {
- execute = forcedFlags;
- forcedFlags = [];
- }
-
- if (typeof forcedFlags === 'string') {
- forcedFlags = [forcedFlags];
- }
-
- if (!Array.isArray(forcedFlags)) {
- forcedFlags = [];
- }
-
- var index = argv.indexOf(FORBID_RESPAWNING_FLAG);
- if (index >= 0) {
- argv = argv.slice(0, index).concat(argv.slice(index + 1));
- argv = remover(flags, argv);
- execute(true, process, argv);
- return;
- }
-
- var proc = process;
- var reordered = reorder(flags, argv);
- var ready = JSON.stringify(argv) === JSON.stringify(reordered);
-
- if (forcedFlags.length) {
- reordered = reordered.slice(0, 1)
- .concat(forcedFlags)
- .concat(reordered.slice(1));
- ready = false;
- }
-
- if (!ready) {
- reordered.push(FORBID_RESPAWNING_FLAG);
- proc = respawn(reordered);
- }
- execute(ready, proc, reordered);
-};
diff --git a/node_modules/flagged-respawn/lib/reorder.js b/node_modules/flagged-respawn/lib/reorder.js
deleted file mode 100644
index 5c72772d2..000000000
--- a/node_modules/flagged-respawn/lib/reorder.js
+++ /dev/null
@@ -1,18 +0,0 @@
-const isV8flags = require('./is-v8flags');
-
-module.exports = function (flags, argv) {
- if (!argv) {
- argv = process.argv;
- }
- var args = [argv[1]];
- argv.slice(2).forEach(function (arg) {
- var flag = arg.split('=')[0];
- if (isV8flags(flag, flags)) {
- args.unshift(arg);
- } else {
- args.push(arg);
- }
- });
- args.unshift(argv[0]);
- return args;
-};
diff --git a/node_modules/flagged-respawn/lib/respawn.js b/node_modules/flagged-respawn/lib/respawn.js
deleted file mode 100644
index c5dd4047c..000000000
--- a/node_modules/flagged-respawn/lib/respawn.js
+++ /dev/null
@@ -1,16 +0,0 @@
-const spawn = require('child_process').spawn;
-
-module.exports = function (argv) {
- var child = spawn(argv[0], argv.slice(1), { stdio: 'inherit' });
- child.on('exit', function (code, signal) {
- process.on('exit', function () {
- /* istanbul ignore if */
- if (signal) {
- process.kill(process.pid, signal);
- } else {
- process.exit(code);
- }
- });
- });
- return child;
-};
diff --git a/node_modules/flagged-respawn/package.json b/node_modules/flagged-respawn/package.json
deleted file mode 100644
index f3a88ec87..000000000
--- a/node_modules/flagged-respawn/package.json
+++ /dev/null
@@ -1,44 +0,0 @@
-{
- "name": "flagged-respawn",
- "description": "A tool for respawning node binaries when special flags are present.",
- "version": "1.0.0",
- "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"
- },
- "license": "MIT",
- "scripts": {
- "lint": "jshint index.js lib/ && jscs index.js lib/",
- "respawn": "node test/bin/respawner --harmony test",
- "nospawn": "node test/bin/respawner test",
- "test": "npm run lint && mocha -R spec test",
- "cover": "nyc --reporter=lcov --reporter=text-summary npm test"
- },
- "main": "index.js",
- "files": [
- "index.js",
- "lib/"
- ],
- "engines": {
- "node": ">= 0.8.0"
- },
- "keywords": [
- "respawn flags"
- ],
- "devDependencies": {
- "chai": "^3.5.0",
- "jscs": "^3.0.7",
- "jshint": "^2.9.5",
- "mocha": "^3.5.3",
- "nyc": "^11.3.0",
- "v8flags": "^3.0.1"
- }
-}