summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/worker-farm
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/worker-farm')
-rw-r--r--deps/npm/node_modules/worker-farm/.travis.yml1
-rw-r--r--deps/npm/node_modules/worker-farm/lib/farm.js4
-rw-r--r--deps/npm/node_modules/worker-farm/node_modules/errno/.npmignore1
-rw-r--r--deps/npm/node_modules/worker-farm/node_modules/errno/.travis.yml11
-rw-r--r--deps/npm/node_modules/worker-farm/node_modules/errno/README.md10
-rwxr-xr-xdeps/npm/node_modules/worker-farm/node_modules/errno/cli.js8
-rw-r--r--deps/npm/node_modules/worker-farm/node_modules/errno/custom.js10
-rw-r--r--deps/npm/node_modules/worker-farm/node_modules/errno/node_modules/prr/.travis.yml2
-rw-r--r--deps/npm/node_modules/worker-farm/node_modules/errno/node_modules/prr/LICENSE39
-rw-r--r--deps/npm/node_modules/worker-farm/node_modules/errno/node_modules/prr/LICENSE.md11
-rw-r--r--deps/npm/node_modules/worker-farm/node_modules/errno/node_modules/prr/README.md8
-rw-r--r--deps/npm/node_modules/worker-farm/node_modules/errno/node_modules/prr/package.json30
-rw-r--r--deps/npm/node_modules/worker-farm/node_modules/errno/package.json30
-rwxr-xr-x[-rw-r--r--]deps/npm/node_modules/worker-farm/node_modules/errno/test.js79
-rw-r--r--deps/npm/node_modules/worker-farm/package.json26
-rw-r--r--deps/npm/node_modules/worker-farm/tests/child.js85
-rw-r--r--deps/npm/node_modules/worker-farm/tests/debug.js11
-rw-r--r--deps/npm/node_modules/worker-farm/tests/index.js541
18 files changed, 108 insertions, 799 deletions
diff --git a/deps/npm/node_modules/worker-farm/.travis.yml b/deps/npm/node_modules/worker-farm/.travis.yml
index 1c9e2b559d..8e23761153 100644
--- a/deps/npm/node_modules/worker-farm/.travis.yml
+++ b/deps/npm/node_modules/worker-farm/.travis.yml
@@ -3,7 +3,6 @@ node_js:
- 4
- 6
- 8
- - 9
branches:
only:
- master
diff --git a/deps/npm/node_modules/worker-farm/lib/farm.js b/deps/npm/node_modules/worker-farm/lib/farm.js
index c77c95d2c7..bdc70e84a1 100644
--- a/deps/npm/node_modules/worker-farm/lib/farm.js
+++ b/deps/npm/node_modules/worker-farm/lib/farm.js
@@ -2,7 +2,7 @@
const DEFAULT_OPTIONS = {
maxCallsPerWorker : Infinity
- , maxConcurrentWorkers : (require('os').cpus() || { length: 1 }).length
+ , maxConcurrentWorkers : require('os').cpus().length
, maxConcurrentCallsPerWorker : 10
, maxConcurrentCalls : Infinity
, maxCallTime : Infinity // exceed this and the whole worker is terminated
@@ -132,7 +132,7 @@ Farm.prototype.stopChild = function (childId) {
setTimeout(function () {
if (child.exitCode === null)
child.child.kill('SIGKILL')
- }, this.options.forcedKillTime).unref()
+ }, this.options.forcedKillTime)
;delete this.children[childId]
this.activeChildren--
}
diff --git a/deps/npm/node_modules/worker-farm/node_modules/errno/.npmignore b/deps/npm/node_modules/worker-farm/node_modules/errno/.npmignore
new file mode 100644
index 0000000000..b512c09d47
--- /dev/null
+++ b/deps/npm/node_modules/worker-farm/node_modules/errno/.npmignore
@@ -0,0 +1 @@
+node_modules \ No newline at end of file
diff --git a/deps/npm/node_modules/worker-farm/node_modules/errno/.travis.yml b/deps/npm/node_modules/worker-farm/node_modules/errno/.travis.yml
deleted file mode 100644
index f996821c51..0000000000
--- a/deps/npm/node_modules/worker-farm/node_modules/errno/.travis.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-sudo: false
-
-language: node_js
-
-node_js:
- - 9
- - 8
- - 7
- - 6
- - 5
- - 4
diff --git a/deps/npm/node_modules/worker-farm/node_modules/errno/README.md b/deps/npm/node_modules/worker-farm/node_modules/errno/README.md
index a4d0fb542d..2c1f8a525d 100644
--- a/deps/npm/node_modules/worker-farm/node_modules/errno/README.md
+++ b/deps/npm/node_modules/worker-farm/node_modules/errno/README.md
@@ -1,10 +1,6 @@
# node-errno
-> Better [libuv](https://github.com/libuv/libuv)/[Node.js](https://nodejs.org)/[io.js](https://iojs.org) error handling & reporting. Available in npm as *errno*.
-
-[![npm](https://img.shields.io/npm/v/errno.svg)](https://www.npmjs.com/package/errno)
-[![Build Status](https://secure.travis-ci.org/rvagg/node-errno.png)](http://travis-ci.org/rvagg/node-errno)
-[![npm](https://img.shields.io/npm/dm/errno.svg)](https://www.npmjs.com/package/errno)
+Better [libuv](https://github.com/libuv/libuv)/[Node.js](https://nodejs.org)/[io.js](https://iojs.org) error handling & reporting. Available in npm as *errno*.
* [errno exposed](#errnoexposed)
* [Custom errors](#customerrors)
@@ -90,7 +86,7 @@ You will need to install with `npm install errno -g` if you want the `errno` com
<a name="customerrors"></a>
## Custom errors
-Use `errno.custom.createError()` to create custom `Error` objects to throw around in your Node.js library. Create error hierarchies so `instanceof` becomes a useful tool in tracking errors. Call-stack is correctly captured at the time you create an instance of the error object, plus a `cause` property will make available the original error object if you pass one in to the constructor.
+Use `errno.custom.createError()` to create custom `Error` objects to throw around in your Node.js library. Create error heirachies so `instanceof` becomes a useful tool in tracking errors. Call-stack is correctly captured at the time you create an instance of the error object, plus a `cause` property will make available the original error object if you pass one in to the constructor.
```js
var create = require('errno').custom.createError
@@ -142,4 +138,4 @@ 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.
+SOFTWARE. \ No newline at end of file
diff --git a/deps/npm/node_modules/worker-farm/node_modules/errno/cli.js b/deps/npm/node_modules/worker-farm/node_modules/errno/cli.js
index 61d179bbe6..f841771b8a 100755
--- a/deps/npm/node_modules/worker-farm/node_modules/errno/cli.js
+++ b/deps/npm/node_modules/worker-farm/node_modules/errno/cli.js
@@ -4,10 +4,8 @@ var errno = require('./')
, arg = process.argv[2]
, data, code
-if (arg === undefined) {
- console.log(JSON.stringify(errno.code, null, 2))
- process.exit(0)
-}
+if (arg === undefined)
+ return console.log(JSON.stringify(errno.code, null, 2))
if ((code = +arg) == arg)
data = errno.errno[code]
@@ -19,4 +17,4 @@ if (data)
else {
console.error('No such errno/code: "' + arg + '"')
process.exit(1)
-}
+} \ No newline at end of file
diff --git a/deps/npm/node_modules/worker-farm/node_modules/errno/custom.js b/deps/npm/node_modules/worker-farm/node_modules/errno/custom.js
index ca8c1d8dcd..7be16c1e4d 100644
--- a/deps/npm/node_modules/worker-farm/node_modules/errno/custom.js
+++ b/deps/npm/node_modules/worker-farm/node_modules/errno/custom.js
@@ -1,15 +1,13 @@
var prr = require('prr')
function init (type, message, cause) {
- if (!!message && typeof message != 'string') {
- message = message.message || message.name
- }
prr(this, {
type : type
, name : type
// can be passed just a 'cause'
, cause : typeof message != 'string' ? message : cause
- , message : message
+ , message : !!message && typeof message != 'string' ? message.message : message
+
}, 'ewr')
}
@@ -17,7 +15,7 @@ function init (type, message, cause) {
function CustomError (message, cause) {
Error.call(this)
if (Error.captureStackTrace)
- Error.captureStackTrace(this, this.constructor)
+ Error.captureStackTrace(this, arguments.callee)
init.call(this, 'CustomError', message, cause)
}
@@ -39,7 +37,7 @@ function createError (errno, type, proto) {
}
Error.call(this)
if (Error.captureStackTrace)
- Error.captureStackTrace(this, err)
+ Error.captureStackTrace(this, arguments.callee)
}
err.prototype = !!proto ? new proto() : new CustomError()
return err
diff --git a/deps/npm/node_modules/worker-farm/node_modules/errno/node_modules/prr/.travis.yml b/deps/npm/node_modules/worker-farm/node_modules/errno/node_modules/prr/.travis.yml
index 33dcbc3a86..fe3f4eb153 100644
--- a/deps/npm/node_modules/worker-farm/node_modules/errno/node_modules/prr/.travis.yml
+++ b/deps/npm/node_modules/worker-farm/node_modules/errno/node_modules/prr/.travis.yml
@@ -7,4 +7,4 @@ branches:
- master
notifications:
email:
- - rod@vagg.org \ No newline at end of file
+ - rod@vagg.org
diff --git a/deps/npm/node_modules/worker-farm/node_modules/errno/node_modules/prr/LICENSE b/deps/npm/node_modules/worker-farm/node_modules/errno/node_modules/prr/LICENSE
new file mode 100644
index 0000000000..f6a0029de1
--- /dev/null
+++ b/deps/npm/node_modules/worker-farm/node_modules/errno/node_modules/prr/LICENSE
@@ -0,0 +1,39 @@
+Copyright 2013, Rod Vagg (the "Original Author")
+All rights reserved.
+
+MIT +no-false-attribs License
+
+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.
+
+Distributions of all or part of the Software intended to be used
+by the recipients as they would use the unmodified Software,
+containing modifications that substantially alter, remove, or
+disable functionality of the Software, outside of the documented
+configuration mechanisms provided by the Software, shall be
+modified such that the Original Author's bug reporting email
+addresses and urls are either replaced with the contact information
+of the parties responsible for the changes, or removed entirely.
+
+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.
+
+
+Except where noted, this license applies to any and all software
+programs and associated documentation files created by the
+Original Author, when distributed with the Software. \ No newline at end of file
diff --git a/deps/npm/node_modules/worker-farm/node_modules/errno/node_modules/prr/LICENSE.md b/deps/npm/node_modules/worker-farm/node_modules/errno/node_modules/prr/LICENSE.md
deleted file mode 100644
index 29b95e39a5..0000000000
--- a/deps/npm/node_modules/worker-farm/node_modules/errno/node_modules/prr/LICENSE.md
+++ /dev/null
@@ -1,11 +0,0 @@
-The MIT License (MIT)
-=====================
-
-Copyright (c) 2014 Rod Vagg
----------------------------
-
-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/deps/npm/node_modules/worker-farm/node_modules/errno/node_modules/prr/README.md b/deps/npm/node_modules/worker-farm/node_modules/errno/node_modules/prr/README.md
index b934048235..3e709e3bd9 100644
--- a/deps/npm/node_modules/worker-farm/node_modules/errno/node_modules/prr/README.md
+++ b/deps/npm/node_modules/worker-farm/node_modules/errno/node_modules/prr/README.md
@@ -4,7 +4,7 @@ An sensible alternative to `Object.defineProperty()`. Available in npm and Ender
## Usage
-Set the property `'foo'` (`obj.foo`) to have the value `'bar'` with default options (`'enumerable'`, `'configurable'` and `'writable'` are all `false`):
+Set the property `'foo'` (`obj.foo`) to have the value `'bar'` with default options (*enumerable, configurable and writable are all false*):
```js
prr(obj, 'foo', 'bar')
@@ -24,9 +24,7 @@ prr(obj, { one: 'one', two: 'two' })
prr(obj, { one: 'one', two: 'two' }, { enumerable: true, writable: true })
```
-### Simplify!
-
-But obviously, having to write out the full options object makes it nearly as bad as the original `Object.defineProperty()` so we can simplify.
+But obviously, having to write out the full options object makes it nearly as bad as the original `Object.defineProperty()` so we can **simplify**.
As an alternative method we can use an options string where each character represents a option: `'e'=='enumerable'`, `'c'=='configurable'` and `'w'=='writable'`:
@@ -44,4 +42,4 @@ Anywhere! For pre-ES5 environments *prr* will simply fall-back to an `object[pro
## Licence
-prr is Copyright (c) 2013 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licensed under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.
+prr is Copyright (c) 2013 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licensed under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details. \ No newline at end of file
diff --git a/deps/npm/node_modules/worker-farm/node_modules/errno/node_modules/prr/package.json b/deps/npm/node_modules/worker-farm/node_modules/errno/node_modules/prr/package.json
index 706d2aec4e..4af59e2e92 100644
--- a/deps/npm/node_modules/worker-farm/node_modules/errno/node_modules/prr/package.json
+++ b/deps/npm/node_modules/worker-farm/node_modules/errno/node_modules/prr/package.json
@@ -1,32 +1,30 @@
{
- "_from": "prr@~1.0.1",
- "_id": "prr@1.0.1",
+ "_from": "prr@~0.0.0",
+ "_id": "prr@0.0.0",
"_inBundle": false,
- "_integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=",
+ "_integrity": "sha1-GoS4WQgyVQFBGFPQCB7j+obikmo=",
"_location": "/worker-farm/errno/prr",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
- "raw": "prr@~1.0.1",
+ "raw": "prr@~0.0.0",
"name": "prr",
"escapedName": "prr",
- "rawSpec": "~1.0.1",
+ "rawSpec": "~0.0.0",
"saveSpec": null,
- "fetchSpec": "~1.0.1"
+ "fetchSpec": "~0.0.0"
},
"_requiredBy": [
"/worker-farm/errno"
],
- "_resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
- "_shasum": "d3fc114ba06995a45ec6893f484ceb1d78f5f476",
- "_spec": "prr@~1.0.1",
- "_where": "/Users/rebecca/code/npm/node_modules/worker-farm/node_modules/errno",
- "author": {
- "name": "Rod Vagg",
- "email": "rod@vagg.org",
- "url": "https://github.com/rvagg"
- },
+ "_resolved": "https://registry.npmjs.org/prr/-/prr-0.0.0.tgz",
+ "_shasum": "1a84b85908325501411853d0081ee3fa86e2926a",
+ "_spec": "prr@~0.0.0",
+ "_where": "/Users/zkat/Documents/code/npm/node_modules/worker-farm/node_modules/errno",
+ "authors": [
+ "Rod Vagg <rod@vagg.org> (https://github.com/rvagg)"
+ ],
"bugs": {
"url": "https://github.com/rvagg/prr/issues"
},
@@ -54,5 +52,5 @@
"scripts": {
"test": "node ./test.js"
},
- "version": "1.0.1"
+ "version": "0.0.0"
}
diff --git a/deps/npm/node_modules/worker-farm/node_modules/errno/package.json b/deps/npm/node_modules/worker-farm/node_modules/errno/package.json
index ce2a8cb2ad..c0df7f24aa 100644
--- a/deps/npm/node_modules/worker-farm/node_modules/errno/package.json
+++ b/deps/npm/node_modules/worker-farm/node_modules/errno/package.json
@@ -1,27 +1,27 @@
{
- "_from": "errno@^0.1.4",
- "_id": "errno@0.1.7",
+ "_from": "errno@>=0.1.1 <0.2.0-0",
+ "_id": "errno@0.1.4",
"_inBundle": false,
- "_integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==",
+ "_integrity": "sha1-uJbiOp5ei6M4cfyZar02NfyaHH0=",
"_location": "/worker-farm/errno",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
- "raw": "errno@^0.1.4",
+ "raw": "errno@>=0.1.1 <0.2.0-0",
"name": "errno",
"escapedName": "errno",
- "rawSpec": "^0.1.4",
+ "rawSpec": ">=0.1.1 <0.2.0-0",
"saveSpec": null,
- "fetchSpec": "^0.1.4"
+ "fetchSpec": ">=0.1.1 <0.2.0-0"
},
"_requiredBy": [
"/worker-farm"
],
- "_resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz",
- "_shasum": "4684d71779ad39af177e3f007996f7c67c852618",
- "_spec": "errno@^0.1.4",
- "_where": "/Users/rebecca/code/npm/node_modules/worker-farm",
+ "_resolved": "https://registry.npmjs.org/errno/-/errno-0.1.4.tgz",
+ "_shasum": "b896e23a9e5e8ba33871fc996abd3635fc9a1c7d",
+ "_spec": "errno@>=0.1.1 <0.2.0-0",
+ "_where": "/Users/zkat/Documents/code/npm/node_modules/worker-farm",
"authors": [
"Rod Vagg @rvagg <rod@vagg.org> (https://github.com/rvagg)"
],
@@ -33,14 +33,12 @@
},
"bundleDependencies": false,
"dependencies": {
- "prr": "~1.0.1"
+ "prr": "~0.0.0"
},
"deprecated": false,
"description": "libuv errno details exposed",
"devDependencies": {
- "error-stack-parser": "^2.0.1",
- "inherits": "^2.0.3",
- "tape": "~4.8.0"
+ "tape": "~3.5.0"
},
"homepage": "https://github.com/rvagg/node-errno#readme",
"keywords": [
@@ -56,7 +54,7 @@
"url": "git+https://github.com/rvagg/node-errno.git"
},
"scripts": {
- "test": "node --use_strict test.js"
+ "test": "tape test.js"
},
- "version": "0.1.7"
+ "version": "0.1.4"
}
diff --git a/deps/npm/node_modules/worker-farm/node_modules/errno/test.js b/deps/npm/node_modules/worker-farm/node_modules/errno/test.js
index 1c046357bc..6b76a85ae1 100644..100755
--- a/deps/npm/node_modules/worker-farm/node_modules/errno/test.js
+++ b/deps/npm/node_modules/worker-farm/node_modules/errno/test.js
@@ -1,27 +1,27 @@
-var test = require('tape')
- , inherits = require('inherits')
- , ErrorStackParser = require('error-stack-parser')
- , errno = require('./')
+#!/usr/bin/env node
+
+var test = require('tape')
+ , errno = require('./')
test('sanity checks', function (t) {
t.ok(errno.all, 'errno.all not found')
t.ok(errno.errno, 'errno.errno not found')
t.ok(errno.code, 'errno.code not found')
- t.equal(errno.all.length, 60, 'found ' + errno.all.length + ', expected 60')
- t.equal(errno.errno['-1'], errno.all[1], 'errno -1 not second element')
+ t.equal(errno.all.length, 59, 'found ' + errno.all.length + ', expected 59')
+ t.equal(errno.errno['-1'], errno.all[0], 'errno -1 not first element')
- t.equal(errno.code['UNKNOWN'], errno.all[1], 'code UNKNOWN not second element')
+ t.equal(errno.code['UNKNOWN'], errno.all[0], 'code UNKNOWN not first element')
- t.equal(errno.errno[1], errno.all[3], 'errno 1 not fourth element')
+ t.equal(errno.errno[1], errno.all[2], 'errno 1 not third element')
- t.equal(errno.code['EOF'], errno.all[3], 'code EOF not fourth element')
+ t.equal(errno.code['EOF'], errno.all[2], 'code EOF not third element')
t.end()
})
test('custom errors', function (t) {
- const Cust = errno.create('FooNotBarError')
- const cust = new Cust('foo is not bar')
+ var Cust = errno.create('FooNotBarError')
+ var cust = new Cust('foo is not bar')
t.equal(cust.name, 'FooNotBarError', 'correct custom name')
t.equal(cust.type, 'FooNotBarError', 'correct custom type')
@@ -29,60 +29,3 @@ test('custom errors', function (t) {
t.notOk(cust.cause, 'no cause')
t.end()
})
-
-test('callstack', function (t) {
- const MyError = errno.create('MyError')
-
- function lastFunction (ErrorType, cb) {
- process.nextTick(cb, new ErrorType('oh noes!'))
- }
-
- function secondLastFunction (ErrorType, cb) {
- lastFunction(ErrorType, cb)
- }
-
- function testFrames (t) {
- return function (err) {
- const stack = ErrorStackParser.parse(err)
- t.same(stack[0].functionName, 'lastFunction', 'last stack frame ok')
- t.same(stack[1].functionName, 'secondLastFunction', 'second last stack frame ok')
- t.end()
- }
- }
-
- t.test('custom error, default prototype', function (t) {
- secondLastFunction(MyError, testFrames(t))
- })
-
- t.test('custom error, custom prototype', function (t) {
- const MyError2 = errno.create('MyError2', MyError)
- secondLastFunction(MyError2, testFrames(t))
- })
-
- t.test('custom error, using inheritance', function (t) {
- const CustomError = errno.custom.CustomError
-
- function MyError3 (message, cause) {
- CustomError.call(this, message, cause)
- }
-
- inherits(MyError3, CustomError)
-
- secondLastFunction(MyError3, testFrames(t))
- })
-})
-
-test('error without message', function (t) {
- const Cust = errno.create('WriteError')
- const cust = new Cust({
- code: 22,
- message: '',
- name: 'QuotaExceededError'
- })
-
- t.equal(cust.name, 'WriteError', 'correct custom name')
- t.equal(cust.type, 'WriteError', 'correct custom type')
- t.equal(cust.message, 'QuotaExceededError', 'message is the name')
- t.notOk(cust.cause, 'no cause')
- t.end()
-})
diff --git a/deps/npm/node_modules/worker-farm/package.json b/deps/npm/node_modules/worker-farm/package.json
index 7adec272cd..d60f581cff 100644
--- a/deps/npm/node_modules/worker-farm/package.json
+++ b/deps/npm/node_modules/worker-farm/package.json
@@ -1,27 +1,27 @@
{
- "_from": "worker-farm@1.5.4",
- "_id": "worker-farm@1.5.4",
+ "_from": "worker-farm@1.5.1",
+ "_id": "worker-farm@1.5.1",
"_inBundle": false,
- "_integrity": "sha512-ITyClEvcfv0ozqJl1vmWFWhvI+OIrkbInYqkEPE50wFPXj8J9Gd3FYf8+CkZJXJJsQBYe+2DvmoK9Zhx5w8W+w==",
+ "_integrity": "sha512-T5NH6Wqsd8MwGD4AK8BBllUy6LmHaqjEOyo/YIUEegZui6/v5Bqde//3jwyE3PGiGYMmWi06exFBi5LNhhPFNw==",
"_location": "/worker-farm",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
- "raw": "worker-farm@1.5.4",
+ "raw": "worker-farm@1.5.1",
"name": "worker-farm",
"escapedName": "worker-farm",
- "rawSpec": "1.5.4",
+ "rawSpec": "1.5.1",
"saveSpec": null,
- "fetchSpec": "1.5.4"
+ "fetchSpec": "1.5.1"
},
"_requiredBy": [
"#USER",
"/"
],
- "_resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.5.4.tgz",
- "_shasum": "4debbe46b40edefcc717ebde74a90b1ae1e909a1",
- "_spec": "worker-farm@1.5.4",
+ "_resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.5.1.tgz",
+ "_shasum": "8e9f4a7da4f3c595aa600903051b969390423fa1",
+ "_spec": "worker-farm@1.5.1",
"_where": "/Users/zkat/Documents/code/npm",
"authors": [
"Rod Vagg @rvagg <rod@vagg.org> (https://github.com/rvagg)"
@@ -31,13 +31,13 @@
},
"bundleDependencies": false,
"dependencies": {
- "errno": "~0.1.7",
- "xtend": "~4.0.1"
+ "errno": "^0.1.4",
+ "xtend": "^4.0.1"
},
"deprecated": false,
"description": "Distribute processing tasks to child processes with an über-simple API and baked-in durability & custom concurrency options.",
"devDependencies": {
- "tape": "~4.9.0"
+ "tape": "^4.7.0"
},
"homepage": "https://github.com/rvagg/node-worker-farm",
"keywords": [
@@ -57,5 +57,5 @@
"test": "node ./tests/"
},
"types": "./index.d.ts",
- "version": "1.5.4"
+ "version": "1.5.1"
}
diff --git a/deps/npm/node_modules/worker-farm/tests/child.js b/deps/npm/node_modules/worker-farm/tests/child.js
deleted file mode 100644
index 85e8f5789e..0000000000
--- a/deps/npm/node_modules/worker-farm/tests/child.js
+++ /dev/null
@@ -1,85 +0,0 @@
-'use strict'
-
-const fs = require('fs')
-const started = Date.now()
-
-
-module.exports = function (timeout, callback) {
- callback = callback.bind(null, null, process.pid, Math.random(), timeout)
- if (timeout)
- return setTimeout(callback, timeout)
- callback()
-}
-
-
-module.exports.args = function (callback) {
- console.log(process.argv)
- console.log(process.execArgv)
- callback()
-}
-
-
-module.exports.run0 = function (callback) {
- module.exports(0, callback)
-}
-
-
-module.exports.killable = function (id, callback) {
- if (Math.random() < 0.5)
- return process.exit(-1)
- callback(null, id, process.pid)
-}
-
-
-module.exports.err = function (type, message, data, callback) {
- if (typeof data == 'function') {
- callback = data
- data = null
- } else {
- let err = new Error(message)
- Object.keys(data).forEach(function(key) {
- err[key] = data[key]
- })
- callback(err)
- return
- }
-
- if (type == 'TypeError')
- return callback(new TypeError(message))
- callback(new Error(message))
-}
-
-
-module.exports.block = function () {
- while (true);
-}
-
-
-// use provided file path to save retries count among terminated workers
-module.exports.stubborn = function (path, callback) {
- function isOutdated(path) {
- return ((new Date).getTime() - fs.statSync(path).mtime.getTime()) > 2000
- }
-
- // file may not be properly deleted, check if modified no earler than two seconds ago
- if (!fs.existsSync(path) || isOutdated(path)) {
- fs.writeFileSync(path, '1')
- process.exit(-1)
- }
-
- let retry = parseInt(fs.readFileSync(path, 'utf8'))
- if (Number.isNaN(retry))
- return callback(new Error('file contents is not a number'))
-
- if (retry > 4) {
- callback(null, 12)
- } else {
- fs.writeFileSync(path, String(retry + 1))
- process.exit(-1)
- }
-}
-
-
-module.exports.uptime = function (callback) {
- callback(null, Date.now() - started)
-}
diff --git a/deps/npm/node_modules/worker-farm/tests/debug.js b/deps/npm/node_modules/worker-farm/tests/debug.js
deleted file mode 100644
index 6ffd446489..0000000000
--- a/deps/npm/node_modules/worker-farm/tests/debug.js
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict'
-
-const workerFarm = require('../')
- , workers = workerFarm(require.resolve('./child'), ['args'])
-
-
-workers.args(function() {
- workerFarm.end(workers)
- console.log('FINISHED')
- process.exit(0)
-})
diff --git a/deps/npm/node_modules/worker-farm/tests/index.js b/deps/npm/node_modules/worker-farm/tests/index.js
deleted file mode 100644
index 32d200ff7b..0000000000
--- a/deps/npm/node_modules/worker-farm/tests/index.js
+++ /dev/null
@@ -1,541 +0,0 @@
-'use strict'
-
-const tape = require('tape')
- , child_process = require('child_process')
- , workerFarm = require('../')
- , childPath = require.resolve('./child')
- , fs = require('fs')
-
-function uniq (ar) {
- let a = [], i, j
- o: for (i = 0; i < ar.length; ++i) {
- for (j = 0; j < a.length; ++j) if (a[j] == ar[i]) continue o
- a[a.length] = ar[i]
- }
- return a
-}
-
-
-// a child where module.exports = function ...
-tape('simple, exports=function test', function (t) {
- t.plan(4)
-
- let child = workerFarm(childPath)
- child(0, function (err, pid, rnd) {
- t.ok(pid > process.pid, 'pid makes sense')
- t.ok(pid < process.pid + 500, 'pid makes sense')
- t.ok(rnd >= 0 && rnd < 1, 'rnd result makes sense')
- })
-
- workerFarm.end(child, function () {
- t.ok(true, 'workerFarm ended')
- })
-})
-
-
-// a child where we have module.exports.fn = function ...
-tape('simple, exports.fn test', function (t) {
- t.plan(4)
-
- let child = workerFarm(childPath, [ 'run0' ])
- child.run0(function (err, pid, rnd) {
- t.ok(pid > process.pid, 'pid makes sense')
- t.ok(pid < process.pid + 500, 'pid makes sense')
- t.ok(rnd >= 0 && rnd < 1, 'rnd result makes sense')
- })
-
- workerFarm.end(child, function () {
- t.ok(true, 'workerFarm ended')
- })
-})
-
-
-// use the returned pids to check that we're using a single child process
-// when maxConcurrentWorkers = 1
-tape('single worker', function (t) {
- t.plan(2)
-
- let child = workerFarm({ maxConcurrentWorkers: 1 }, childPath)
- , pids = []
- , i = 10
-
- while (i--) {
- child(0, function (err, pid) {
- pids.push(pid)
- if (pids.length == 10) {
- t.equal(1, uniq(pids).length, 'only a single process (by pid)')
- } else if (pids.length > 10)
- t.fail('too many callbacks!')
- })
- }
-
- workerFarm.end(child, function () {
- t.ok(true, 'workerFarm ended')
- })
-})
-
-
-// use the returned pids to check that we're using two child processes
-// when maxConcurrentWorkers = 2
-tape('two workers', function (t) {
- t.plan(2)
-
- let child = workerFarm({ maxConcurrentWorkers: 2 }, childPath)
- , pids = []
- , i = 10
-
- while (i--) {
- child(0, function (err, pid) {
- pids.push(pid)
- if (pids.length == 10) {
- t.equal(2, uniq(pids).length, 'only two child processes (by pid)')
- } else if (pids.length > 10)
- t.fail('too many callbacks!')
- })
- }
-
- workerFarm.end(child, function () {
- t.ok(true, 'workerFarm ended')
- })
-})
-
-
-// use the returned pids to check that we're using a child process per
-// call when maxConcurrentWorkers = 10
-tape('many workers', function (t) {
- t.plan(2)
-
- let child = workerFarm({ maxConcurrentWorkers: 10 }, childPath)
- , pids = []
- , i = 10
-
- while (i--) {
- child(1, function (err, pid) {
- pids.push(pid)
- if (pids.length == 10) {
- t.equal(10, uniq(pids).length, 'pids are all the same (by pid)')
- } else if (pids.length > 10)
- t.fail('too many callbacks!')
- })
- }
-
- workerFarm.end(child, function () {
- t.ok(true, 'workerFarm ended')
- })
-})
-
-
-tape('auto start workers', function (t) {
- let child = workerFarm({ maxConcurrentWorkers: 3, autoStart: true }, childPath, ['uptime'])
- , pids = []
- , count = 5
- , i = count
- , delay = 250
-
- t.plan(count + 1)
-
- setTimeout(function() {
- while (i--)
- child.uptime(function (err, uptime) {
- t.ok(uptime > 10, 'child has been up before the request (' + uptime + 'ms)')
- })
-
- workerFarm.end(child, function () {
- t.ok(true, 'workerFarm ended')
- })
- }, delay)
-})
-
-
-// use the returned pids to check that we're using a child process per
-// call when we set maxCallsPerWorker = 1 even when we have maxConcurrentWorkers = 1
-tape('single call per worker', function (t) {
- t.plan(2)
-
- let child = workerFarm({
- maxConcurrentWorkers: 1
- , maxConcurrentCallsPerWorker: Infinity
- , maxCallsPerWorker: 1
- , autoStart: true
- }, childPath)
- , pids = []
- , count = 25
- , i = count
-
- while (i--) {
- child(0, function (err, pid) {
- pids.push(pid)
- if (pids.length == count) {
- t.equal(count, uniq(pids).length, 'one process for each call (by pid)')
- workerFarm.end(child, function () {
- t.ok(true, 'workerFarm ended')
- })
- } else if (pids.length > count)
- t.fail('too many callbacks!')
- })
- }
-})
-
-
-// use the returned pids to check that we're using a child process per
-// two-calls when we set maxCallsPerWorker = 2 even when we have maxConcurrentWorkers = 1
-tape('two calls per worker', function (t) {
- t.plan(2)
-
- let child = workerFarm({
- maxConcurrentWorkers: 1
- , maxConcurrentCallsPerWorker: Infinity
- , maxCallsPerWorker: 2
- , autoStart: true
- }, childPath)
- , pids = []
- , count = 20
- , i = count
-
- while (i--) {
- child(0, function (err, pid) {
- pids.push(pid)
- if (pids.length == count) {
- t.equal(count / 2, uniq(pids).length, 'one process for each call (by pid)')
- workerFarm.end(child, function () {
- t.ok(true, 'workerFarm ended')
- })
- } else if (pids.length > count)
- t.fail('too many callbacks!')
- })
- }
-})
-
-
-// use timing to confirm that one worker will process calls sequentially
-tape('many concurrent calls', function (t) {
- t.plan(2)
-
- let child = workerFarm({
- maxConcurrentWorkers: 1
- , maxConcurrentCallsPerWorker: Infinity
- , maxCallsPerWorker: Infinity
- , autoStart: true
- }, childPath)
- , defer = 200
- , count = 200
- , i = count
- , cbc = 0
-
- setTimeout(function () {
- let start = Date.now()
-
- while (i--) {
- child(defer, function () {
- if (++cbc == count) {
- let time = Date.now() - start
- // upper-limit not tied to `count` at all
- t.ok(time > defer && time < (defer * 2.5), 'processed tasks concurrently (' + time + 'ms)')
- workerFarm.end(child, function () {
- t.ok(true, 'workerFarm ended')
- })
- } else if (cbc > count)
- t.fail('too many callbacks!')
- })
- }
- }, 250)
-})
-
-
-// use timing to confirm that one child processes calls sequentially with
-// maxConcurrentCallsPerWorker = 1
-tape('single concurrent call', function (t) {
- t.plan(2)
-
- let child = workerFarm({
- maxConcurrentWorkers: 1
- , maxConcurrentCallsPerWorker: 1
- , maxCallsPerWorker: Infinity
- , autoStart: true
- }, childPath)
- , defer = 20
- , count = 100
- , i = count
- , cbc = 0
-
- setTimeout(function () {
- let start = Date.now()
-
- while (i--) {
- child(defer, function () {
- if (++cbc == count) {
- let time = Date.now() - start
- // upper-limit tied closely to `count`, 1.3 is generous but accounts for all the timers
- // coming back at the same time and the IPC overhead
- t.ok(time > (defer * count) && time < (defer * count * 1.3), 'processed tasks sequentially (' + time + ')')
- workerFarm.end(child, function () {
- t.ok(true, 'workerFarm ended')
- })
- } else if (cbc > count)
- t.fail('too many callbacks!')
- })
- }
- }, 250)
-})
-
-
-// use timing to confirm that one child processes *only* 5 calls concurrently
-tape('multiple concurrent calls', function (t) {
- t.plan(2)
-
- let callsPerWorker = 5
- , child = workerFarm({
- maxConcurrentWorkers: 1
- , maxConcurrentCallsPerWorker: callsPerWorker
- , maxCallsPerWorker: Infinity
- , autoStart: true
- }, childPath)
- , defer = 100
- , count = 100
- , i = count
- , cbc = 0
-
- setTimeout(function () {
- let start = Date.now()
-
- while (i--) {
- child(defer, function () {
- if (++cbc == count) {
- let time = Date.now() - start
- // (defer * (count / callsPerWorker + 1)) - if precise it'd be count/callsPerWorker
- // but accounting for IPC and other overhead, we need to give it a bit of extra time,
- // hence the +1
- t.ok(time > (defer * 1.5) && time < (defer * (count / callsPerWorker + 1)), 'processed tasks concurrently (' + time + 'ms)')
- workerFarm.end(child, function () {
- t.ok(true, 'workerFarm ended')
- })
- } else if (cbc > count)
- t.fail('too many callbacks!')
- })
- }
- }, 250)
-})
-
-
-// call a method that will die with a probability of 0.5 but expect that
-// we'll get results for each of our calls anyway
-tape('durability', function (t) {
- t.plan(3)
-
- let child = workerFarm({ maxConcurrentWorkers: 2 }, childPath, [ 'killable' ])
- , ids = []
- , pids = []
- , count = 20
- , i = count
-
- while (i--) {
- child.killable(i, function (err, id, pid) {
- ids.push(id)
- pids.push(pid)
- if (ids.length == count) {
- t.ok(uniq(pids).length > 2, 'processed by many (' + uniq(pids).length + ') workers, but got there in the end!')
- t.ok(uniq(ids).length == count, 'received a single result for each unique call')
- workerFarm.end(child, function () {
- t.ok(true, 'workerFarm ended')
- })
- } else if (ids.length > count)
- t.fail('too many callbacks!')
- })
- }
-})
-
-
-// a callback provided to .end() can and will be called (uses "simple, exports=function test" to create a child)
-tape('simple, end callback', function (t) {
- t.plan(4)
-
- let child = workerFarm(childPath)
- child(0, function (err, pid, rnd) {
- t.ok(pid > process.pid, 'pid makes sense ' + pid + ' vs ' + process.pid)
- t.ok(pid < process.pid + 500, 'pid makes sense ' + pid + ' vs ' + process.pid)
- t.ok(rnd >= 0 && rnd < 1, 'rnd result makes sense')
- })
-
- workerFarm.end(child, function() {
- t.pass('an .end() callback was successfully called')
- })
-})
-
-
-tape('call timeout test', function (t) {
- t.plan(3 + 3 + 4 + 4 + 4 + 3 + 1)
-
- let child = workerFarm({ maxCallTime: 250, maxConcurrentWorkers: 1 }, childPath)
-
- // should come back ok
- child(50, function (err, pid, rnd) {
- t.ok(pid > process.pid, 'pid makes sense ' + pid + ' vs ' + process.pid)
- t.ok(pid < process.pid + 500, 'pid makes sense ' + pid + ' vs ' + process.pid)
- t.ok(rnd > 0 && rnd < 1, 'rnd result makes sense ' + rnd)
- })
-
- // should come back ok
- child(50, function (err, pid, rnd) {
- t.ok(pid > process.pid, 'pid makes sense ' + pid + ' vs ' + process.pid)
- t.ok(pid < process.pid + 500, 'pid makes sense ' + pid + ' vs ' + process.pid)
- t.ok(rnd > 0 && rnd < 1, 'rnd result makes sense ' + rnd)
- })
-
- // should die
- child(500, function (err, pid, rnd) {
- t.ok(err, 'got an error')
- t.equal(err.type, 'TimeoutError', 'correct error type')
- t.ok(pid === undefined, 'no pid')
- t.ok(rnd === undefined, 'no rnd')
- })
-
- // should die
- child(1000, function (err, pid, rnd) {
- t.ok(err, 'got an error')
- t.equal(err.type, 'TimeoutError', 'correct error type')
- t.ok(pid === undefined, 'no pid')
- t.ok(rnd === undefined, 'no rnd')
- })
-
- // should die even though it is only a 100ms task, it'll get caught up
- // in a dying worker
- setTimeout(function () {
- child(100, function (err, pid, rnd) {
- t.ok(err, 'got an error')
- t.equal(err.type, 'TimeoutError', 'correct error type')
- t.ok(pid === undefined, 'no pid')
- t.ok(rnd === undefined, 'no rnd')
- })
- }, 200)
-
- // should be ok, new worker
- setTimeout(function () {
- child(50, function (err, pid, rnd) {
- t.ok(pid > process.pid, 'pid makes sense ' + pid + ' vs ' + process.pid)
- t.ok(pid < process.pid + 500, 'pid makes sense ' + pid + ' vs ' + process.pid)
- t.ok(rnd > 0 && rnd < 1, 'rnd result makes sense ' + rnd)
- })
- workerFarm.end(child, function () {
- t.ok(true, 'workerFarm ended')
- })
- }, 400)
-})
-
-
-tape('test error passing', function (t) {
- t.plan(10)
-
- let child = workerFarm(childPath, [ 'err' ])
- child.err('Error', 'this is an Error', function (err) {
- t.ok(err instanceof Error, 'is an Error object')
- t.equal('Error', err.type, 'correct type')
- t.equal('this is an Error', err.message, 'correct message')
- })
- child.err('TypeError', 'this is a TypeError', function (err) {
- t.ok(err instanceof Error, 'is a TypeError object')
- t.equal('TypeError', err.type, 'correct type')
- t.equal('this is a TypeError', err.message, 'correct message')
- })
- child.err('Error', 'this is an Error with custom props', {foo: 'bar', 'baz': 1}, function (err) {
- t.ok(err instanceof Error, 'is an Error object')
- t.equal(err.foo, 'bar', 'passes data')
- t.equal(err.baz, 1, 'passes data')
- })
-
- workerFarm.end(child, function () {
- t.ok(true, 'workerFarm ended')
- })
-})
-
-
-tape('test maxConcurrentCalls', function (t) {
- t.plan(10)
-
- let child = workerFarm({ maxConcurrentCalls: 5 }, childPath)
-
- child(50, function (err) { t.notOk(err, 'no error') })
- child(50, function (err) { t.notOk(err, 'no error') })
- child(50, function (err) { t.notOk(err, 'no error') })
- child(50, function (err) { t.notOk(err, 'no error') })
- child(50, function (err) { t.notOk(err, 'no error') })
- child(50, function (err) {
- t.ok(err)
- t.equal(err.type, 'MaxConcurrentCallsError', 'correct error type')
- })
- child(50, function (err) {
- t.ok(err)
- t.equal(err.type, 'MaxConcurrentCallsError', 'correct error type')
- })
-
- workerFarm.end(child, function () {
- t.ok(true, 'workerFarm ended')
- })
-})
-
-
-// this test should not keep the process running! if the test process
-// doesn't die then the problem is here
-tape('test timeout kill', function (t) {
- t.plan(3)
-
- let child = workerFarm({ maxCallTime: 250, maxConcurrentWorkers: 1 }, childPath, [ 'block' ])
- child.block(function (err) {
- t.ok(err, 'got an error')
- t.equal(err.type, 'TimeoutError', 'correct error type')
- })
-
- workerFarm.end(child, function () {
- t.ok(true, 'workerFarm ended')
- })
-})
-
-
-tape('test max retries after process terminate', function (t) {
- t.plan(7)
-
- // temporary file is used to store the number of retries among terminating workers
- let filepath1 = '.retries1'
- let child1 = workerFarm({ maxConcurrentWorkers: 1, maxRetries: 5}, childPath, [ 'stubborn' ])
- child1.stubborn(filepath1, function (err, result) {
- t.notOk(err, 'no error')
- t.equal(result, 12, 'correct result')
- })
-
- workerFarm.end(child1, function () {
- fs.unlinkSync(filepath1)
- t.ok(true, 'workerFarm ended')
- })
-
- let filepath2 = '.retries2'
- let child2 = workerFarm({ maxConcurrentWorkers: 1, maxRetries: 3}, childPath, [ 'stubborn' ])
- child2.stubborn(filepath2, function (err, result) {
- t.ok(err, 'got an error')
- t.equal(err.type, 'ProcessTerminatedError', 'correct error type')
- t.equal(err.message, 'cancel after 3 retries!', 'correct message and number of retries')
- })
-
- workerFarm.end(child2, function () {
- fs.unlinkSync(filepath2)
- t.ok(true, 'workerFarm ended')
- })
-})
-
-
-tape('ensure --debug/--inspect not propagated to children', function (t) {
- t.plan(3)
-
- let script = __dirname + '/debug.js'
- , debugArg = process.version.replace(/^v(\d+)\..*$/, '$1') >= 8 ? '--inspect' : '--debug=8881'
- , child = child_process.spawn(process.execPath, [ debugArg, script ])
- , stdout = ''
-
- child.stdout.on('data', function (data) {
- stdout += data.toString()
- })
-
- child.on('close', function (code) {
- t.equal(code, 0, 'exited without error (' + code + ')')
- t.ok(stdout.indexOf('FINISHED') > -1, 'process finished')
- t.ok(stdout.indexOf('--debug') === -1, 'child does not receive debug flag')
- })
-})