This commit is contained in:
Stephen Franceschelli 2019-07-30 13:41:05 -04:00
parent 596a6da241
commit c1a589c5b6
7078 changed files with 1882834 additions and 319 deletions

14
node_modules/exit/.jshintrc generated vendored Normal file
View file

@ -0,0 +1,14 @@
{
"curly": true,
"eqeqeq": true,
"immed": true,
"latedef": "nofunc",
"newcap": true,
"noarg": true,
"sub": true,
"undef": true,
"unused": true,
"boss": true,
"eqnull": true,
"node": true
}

0
node_modules/exit/.npmignore generated vendored Normal file
View file

6
node_modules/exit/.travis.yml generated vendored Normal file
View file

@ -0,0 +1,6 @@
language: node_js
node_js:
- 0.8
- '0.10'
before_script:
- npm install -g grunt-cli

48
node_modules/exit/Gruntfile.js generated vendored Normal file
View file

@ -0,0 +1,48 @@
'use strict';
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
nodeunit: {
files: ['test/**/*_test.js'],
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
gruntfile: {
src: 'Gruntfile.js'
},
lib: {
src: ['lib/**/*.js']
},
test: {
src: ['test/**/*.js']
},
},
watch: {
gruntfile: {
files: '<%= jshint.gruntfile.src %>',
tasks: ['jshint:gruntfile']
},
lib: {
files: '<%= jshint.lib.src %>',
tasks: ['jshint:lib', 'nodeunit']
},
test: {
files: '<%= jshint.test.src %>',
tasks: ['jshint:test', 'nodeunit']
},
},
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-nodeunit');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
// Default task.
grunt.registerTask('default', ['jshint', 'nodeunit']);
};

22
node_modules/exit/LICENSE-MIT generated vendored Normal file
View file

@ -0,0 +1,22 @@
Copyright (c) 2013 "Cowboy" Ben Alman
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.

75
node_modules/exit/README.md generated vendored Normal file
View file

@ -0,0 +1,75 @@
# exit [![Build Status](https://secure.travis-ci.org/cowboy/node-exit.png?branch=master)](http://travis-ci.org/cowboy/node-exit)
A replacement for process.exit that ensures stdio are fully drained before exiting.
To make a long story short, if `process.exit` is called on Windows, script output is often truncated when pipe-redirecting `stdout` or `stderr`. This module attempts to work around this issue by waiting until those streams have been completely drained before actually calling `process.exit`.
See [Node.js issue #3584](https://github.com/joyent/node/issues/3584) for further reference.
Tested in OS X 10.8, Windows 7 on Node.js 0.8.25 and 0.10.18.
Based on some code by [@vladikoff](https://github.com/vladikoff).
## Getting Started
Install the module with: `npm install exit`
```javascript
var exit = require('exit');
// These lines should appear in the output, EVEN ON WINDOWS.
console.log("omg");
console.error("yay");
// process.exit(5);
exit(5);
// These lines shouldn't appear in the output.
console.log("wtf");
console.error("bro");
```
## Don't believe me? Try it for yourself.
In Windows, clone the repo and cd to the `test\fixtures` directory. The only difference between [log.js](test/fixtures/log.js) and [log-broken.js](test/fixtures/log-broken.js) is that the former uses `exit` while the latter calls `process.exit` directly.
This test was done using cmd.exe, but you can see the same results using `| grep "std"` in either PowerShell or git-bash.
```
C:\node-exit\test\fixtures>node log.js 0 10 stdout stderr 2>&1 | find "std"
stdout 0
stderr 0
stdout 1
stderr 1
stdout 2
stderr 2
stdout 3
stderr 3
stdout 4
stderr 4
stdout 5
stderr 5
stdout 6
stderr 6
stdout 7
stderr 7
stdout 8
stderr 8
stdout 9
stderr 9
C:\node-exit\test\fixtures>node log-broken.js 0 10 stdout stderr 2>&1 | find "std"
C:\node-exit\test\fixtures>
```
## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).
## Release History
2013-11-26 - v0.1.2 - Fixed a bug with hanging processes.
2013-09-26 - v0.1.1 - Fixed some bugs. It seems to actually work now!
2013-09-20 - v0.1.0 - Initial release.
## License
Copyright (c) 2013 "Cowboy" Ben Alman
Licensed under the MIT license.

41
node_modules/exit/lib/exit.js generated vendored Normal file
View file

@ -0,0 +1,41 @@
/*
* exit
* https://github.com/cowboy/node-exit
*
* Copyright (c) 2013 "Cowboy" Ben Alman
* Licensed under the MIT license.
*/
'use strict';
module.exports = function exit(exitCode, streams) {
if (!streams) { streams = [process.stdout, process.stderr]; }
var drainCount = 0;
// Actually exit if all streams are drained.
function tryToExit() {
if (drainCount === streams.length) {
process.exit(exitCode);
}
}
streams.forEach(function(stream) {
// Count drained streams now, but monitor non-drained streams.
if (stream.bufferSize === 0) {
drainCount++;
} else {
stream.write('', 'utf-8', function() {
drainCount++;
tryToExit();
});
}
// Prevent further writing.
stream.write = function() {};
});
// If all streams were already drained, exit now.
tryToExit();
// In Windows, when run as a Node.js child process, a script utilizing
// this library might just exit with a 0 exit code, regardless. This code,
// despite the fact that it looks a bit crazy, appears to fix that.
process.on('exit', function() {
process.exit(exitCode);
});
};

76
node_modules/exit/package.json generated vendored Normal file
View file

@ -0,0 +1,76 @@
{
"_from": "exit@^0.1.2",
"_id": "exit@0.1.2",
"_inBundle": false,
"_integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=",
"_location": "/exit",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "exit@^0.1.2",
"name": "exit",
"escapedName": "exit",
"rawSpec": "^0.1.2",
"saveSpec": null,
"fetchSpec": "^0.1.2"
},
"_requiredBy": [
"/@jest/core",
"/@jest/reporters",
"/jest-runner",
"/jest-runtime",
"/jest/jest-cli"
],
"_resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz",
"_shasum": "0632638f8d877cc82107d30a0fff1a17cba1cd0c",
"_spec": "exit@^0.1.2",
"_where": "E:\\github\\setup-java\\node_modules\\jest\\node_modules\\jest-cli",
"author": {
"name": "\"Cowboy\" Ben Alman",
"url": "http://benalman.com/"
},
"bugs": {
"url": "https://github.com/cowboy/node-exit/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "A replacement for process.exit that ensures stdio are fully drained before exiting.",
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-jshint": "~0.6.4",
"grunt-contrib-nodeunit": "~0.2.0",
"grunt-contrib-watch": "~0.5.3",
"which": "~1.0.5"
},
"engines": {
"node": ">= 0.8.0"
},
"homepage": "https://github.com/cowboy/node-exit",
"keywords": [
"exit",
"process",
"stdio",
"stdout",
"stderr",
"drain",
"flush",
"3584"
],
"licenses": [
{
"type": "MIT",
"url": "https://github.com/cowboy/node-exit/blob/master/LICENSE-MIT"
}
],
"main": "lib/exit",
"name": "exit",
"repository": {
"type": "git",
"url": "git://github.com/cowboy/node-exit.git"
},
"scripts": {
"test": "grunt nodeunit"
},
"version": "0.1.2"
}

121
node_modules/exit/test/exit_test.js generated vendored Normal file
View file

@ -0,0 +1,121 @@
'use strict';
/*
======== A Handy Little Nodeunit Reference ========
https://github.com/caolan/nodeunit
Test methods:
test.expect(numAssertions)
test.done()
Test assertions:
test.ok(value, [message])
test.equal(actual, expected, [message])
test.notEqual(actual, expected, [message])
test.deepEqual(actual, expected, [message])
test.notDeepEqual(actual, expected, [message])
test.strictEqual(actual, expected, [message])
test.notStrictEqual(actual, expected, [message])
test.throws(block, [error], [message])
test.doesNotThrow(block, [error], [message])
test.ifError(value)
*/
var fs = require('fs');
var exec = require('child_process').exec;
var _which = require('which').sync;
function which(command) {
try {
_which(command);
return command;
} catch (err) {
return false;
}
}
// Look for grep first (any OS). If not found (but on Windows) look for find,
// which is Windows' horribly crippled grep alternative.
var grep = which('grep') || process.platform === 'win32' && which('find');
exports['exit'] = {
setUp: function(done) {
this.origCwd = process.cwd();
process.chdir('test/fixtures');
done();
},
tearDown: function(done) {
process.chdir(this.origCwd);
done();
},
'grep': function(test) {
test.expect(1);
// Many unit tests depend on this.
test.ok(grep, 'A suitable "grep" or "find" program was not found in the PATH.');
test.done();
},
// The rest of the tests are built dynamically, to keep things sane.
};
// A few helper functions.
function normalizeLineEndings(s) {
return s.replace(/\r?\n/g, '\n');
}
// Capture command output, normalizing captured stdout to unix file endings.
function run(command, callback) {
exec(command, function(error, stdout) {
callback(error ? error.code : 0, normalizeLineEndings(stdout));
});
}
// Read a fixture file, normalizing file contents to unix file endings.
function fixture(filename) {
return normalizeLineEndings(String(fs.readFileSync(filename)));
}
function buildTests() {
// Build individual unit tests for command output.
var counts = [10, 100, 1000];
var outputs = [' stdout stderr', ' stdout', ' stderr'];
var pipes = ['', ' | ' + grep + ' "std"'];
counts.forEach(function(count) {
outputs.forEach(function(output) {
pipes.forEach(function(pipe) {
var command = 'node log.js 0 ' + count + output + ' 2>&1' + pipe;
exports['exit']['output (' + command + ')'] = function(test) {
test.expect(2);
run(command, function(code, actual) {
var expected = fixture(count + output.replace(/ /g, '-') + '.txt');
// Sometimes, the actual file lines are out of order on Windows.
// But since the point of this lib is to drain the buffer and not
// guarantee output order, we only test the length.
test.equal(actual.length, expected.length, 'should be the same length.');
// The "fail" lines in log.js should NOT be output!
test.ok(actual.indexOf('fail') === -1, 'should not output after exit is called.');
test.done();
});
};
});
});
});
// Build individual unit tests for exit codes.
var codes = [0, 1, 123];
codes.forEach(function(code) {
var command = 'node log.js ' + code + ' 10 stdout stderr';
exports['exit']['exit code (' + command + ')'] = function(test) {
test.expect(1);
run(command, function(actual) {
// The specified exit code should be passed through.
test.equal(actual, code, 'should exit with ' + code + ' error code.');
test.done();
});
};
});
}
// Don't bother building tests if grep wasn't found, otherwise everything will
// fail and the error will get lost.
if (grep) {
buildTests();
}

10
node_modules/exit/test/fixtures/10-stderr.txt generated vendored Normal file
View file

@ -0,0 +1,10 @@
stderr 0
stderr 1
stderr 2
stderr 3
stderr 4
stderr 5
stderr 6
stderr 7
stderr 8
stderr 9

20
node_modules/exit/test/fixtures/10-stdout-stderr.txt generated vendored Normal file
View file

@ -0,0 +1,20 @@
stdout 0
stderr 0
stdout 1
stdout 2
stderr 1
stdout 3
stderr 2
stderr 3
stdout 4
stderr 4
stdout 5
stderr 5
stdout 6
stderr 6
stdout 7
stderr 7
stdout 8
stderr 8
stdout 9
stderr 9

10
node_modules/exit/test/fixtures/10-stdout.txt generated vendored Normal file
View file

@ -0,0 +1,10 @@
stdout 0
stdout 1
stdout 2
stdout 3
stdout 4
stdout 5
stdout 6
stdout 7
stdout 8
stdout 9

100
node_modules/exit/test/fixtures/100-stderr.txt generated vendored Normal file
View file

@ -0,0 +1,100 @@
stderr 0
stderr 1
stderr 2
stderr 3
stderr 4
stderr 5
stderr 6
stderr 7
stderr 8
stderr 9
stderr 10
stderr 11
stderr 12
stderr 13
stderr 14
stderr 15
stderr 16
stderr 17
stderr 18
stderr 19
stderr 20
stderr 21
stderr 22
stderr 23
stderr 24
stderr 25
stderr 26
stderr 27
stderr 28
stderr 29
stderr 30
stderr 31
stderr 32
stderr 33
stderr 34
stderr 35
stderr 36
stderr 37
stderr 38
stderr 39
stderr 40
stderr 41
stderr 42
stderr 43
stderr 44
stderr 45
stderr 46
stderr 47
stderr 48
stderr 49
stderr 50
stderr 51
stderr 52
stderr 53
stderr 54
stderr 55
stderr 56
stderr 57
stderr 58
stderr 59
stderr 60
stderr 61
stderr 62
stderr 63
stderr 64
stderr 65
stderr 66
stderr 67
stderr 68
stderr 69
stderr 70
stderr 71
stderr 72
stderr 73
stderr 74
stderr 75
stderr 76
stderr 77
stderr 78
stderr 79
stderr 80
stderr 81
stderr 82
stderr 83
stderr 84
stderr 85
stderr 86
stderr 87
stderr 88
stderr 89
stderr 90
stderr 91
stderr 92
stderr 93
stderr 94
stderr 95
stderr 96
stderr 97
stderr 98
stderr 99

200
node_modules/exit/test/fixtures/100-stdout-stderr.txt generated vendored Normal file
View file

@ -0,0 +1,200 @@
stdout 0
stderr 0
stdout 1
stderr 1
stdout 2
stderr 2
stdout 3
stderr 3
stdout 4
stderr 4
stdout 5
stderr 5
stdout 6
stderr 6
stdout 7
stderr 7
stdout 8
stderr 8
stdout 9
stderr 9
stdout 10
stderr 10
stdout 11
stderr 11
stdout 12
stderr 12
stdout 13
stderr 13
stdout 14
stderr 14
stdout 15
stderr 15
stdout 16
stderr 16
stdout 17
stderr 17
stdout 18
stderr 18
stdout 19
stderr 19
stdout 20
stderr 20
stdout 21
stderr 21
stdout 22
stderr 22
stdout 23
stderr 23
stdout 24
stderr 24
stdout 25
stderr 25
stdout 26
stderr 26
stdout 27
stderr 27
stdout 28
stderr 28
stdout 29
stderr 29
stdout 30
stderr 30
stdout 31
stderr 31
stdout 32
stderr 32
stdout 33
stderr 33
stdout 34
stderr 34
stdout 35
stderr 35
stdout 36
stderr 36
stdout 37
stderr 37
stdout 38
stderr 38
stdout 39
stderr 39
stdout 40
stderr 40
stdout 41
stderr 41
stdout 42
stderr 42
stdout 43
stderr 43
stdout 44
stderr 44
stdout 45
stderr 45
stdout 46
stderr 46
stdout 47
stderr 47
stdout 48
stderr 48
stdout 49
stderr 49
stdout 50
stderr 50
stdout 51
stderr 51
stdout 52
stderr 52
stdout 53
stderr 53
stdout 54
stderr 54
stdout 55
stderr 55
stdout 56
stderr 56
stdout 57
stderr 57
stdout 58
stderr 58
stdout 59
stderr 59
stdout 60
stderr 60
stdout 61
stderr 61
stdout 62
stderr 62
stdout 63
stderr 63
stdout 64
stderr 64
stdout 65
stderr 65
stdout 66
stderr 66
stdout 67
stderr 67
stdout 68
stderr 68
stdout 69
stderr 69
stdout 70
stderr 70
stdout 71
stderr 71
stdout 72
stderr 72
stdout 73
stderr 73
stdout 74
stderr 74
stdout 75
stderr 75
stdout 76
stderr 76
stdout 77
stderr 77
stdout 78
stderr 78
stdout 79
stderr 79
stdout 80
stderr 80
stdout 81
stderr 81
stdout 82
stderr 82
stdout 83
stderr 83
stdout 84
stderr 84
stdout 85
stderr 85
stdout 86
stderr 86
stdout 87
stderr 87
stdout 88
stderr 88
stdout 89
stderr 89
stdout 90
stderr 90
stdout 91
stderr 91
stdout 92
stderr 92
stdout 93
stderr 93
stdout 94
stderr 94
stdout 95
stderr 95
stdout 96
stderr 96
stdout 97
stderr 97
stdout 98
stderr 98
stdout 99
stderr 99

100
node_modules/exit/test/fixtures/100-stdout.txt generated vendored Normal file
View file

@ -0,0 +1,100 @@
stdout 0
stdout 1
stdout 2
stdout 3
stdout 4
stdout 5
stdout 6
stdout 7
stdout 8
stdout 9
stdout 10
stdout 11
stdout 12
stdout 13
stdout 14
stdout 15
stdout 16
stdout 17
stdout 18
stdout 19
stdout 20
stdout 21
stdout 22
stdout 23
stdout 24
stdout 25
stdout 26
stdout 27
stdout 28
stdout 29
stdout 30
stdout 31
stdout 32
stdout 33
stdout 34
stdout 35
stdout 36
stdout 37
stdout 38
stdout 39
stdout 40
stdout 41
stdout 42
stdout 43
stdout 44
stdout 45
stdout 46
stdout 47
stdout 48
stdout 49
stdout 50
stdout 51
stdout 52
stdout 53
stdout 54
stdout 55
stdout 56
stdout 57
stdout 58
stdout 59
stdout 60
stdout 61
stdout 62
stdout 63
stdout 64
stdout 65
stdout 66
stdout 67
stdout 68
stdout 69
stdout 70
stdout 71
stdout 72
stdout 73
stdout 74
stdout 75
stdout 76
stdout 77
stdout 78
stdout 79
stdout 80
stdout 81
stdout 82
stdout 83
stdout 84
stdout 85
stdout 86
stdout 87
stdout 88
stdout 89
stdout 90
stdout 91
stdout 92
stdout 93
stdout 94
stdout 95
stdout 96
stdout 97
stdout 98
stdout 99

1000
node_modules/exit/test/fixtures/1000-stderr.txt generated vendored Normal file

File diff suppressed because it is too large Load diff

2000
node_modules/exit/test/fixtures/1000-stdout-stderr.txt generated vendored Normal file

File diff suppressed because it is too large Load diff

1000
node_modules/exit/test/fixtures/1000-stdout.txt generated vendored Normal file

File diff suppressed because it is too large Load diff

8
node_modules/exit/test/fixtures/create-files.sh generated vendored Normal file
View file

@ -0,0 +1,8 @@
#!/usr/bin/env bash
rm 10*.txt
for n in 10 100 1000; do
node log.js 0 $n stdout stderr &> $n-stdout-stderr.txt
node log.js 0 $n stdout &> $n-stdout.txt
node log.js 0 $n stderr &> $n-stderr.txt
done

23
node_modules/exit/test/fixtures/log-broken.js generated vendored Normal file
View file

@ -0,0 +1,23 @@
var errorCode = process.argv[2];
var max = process.argv[3];
var modes = process.argv.slice(4);
function stdout(message) {
if (modes.indexOf('stdout') === -1) { return; }
process.stdout.write('stdout ' + message + '\n');
}
function stderr(message) {
if (modes.indexOf('stderr') === -1) { return; }
process.stderr.write('stderr ' + message + '\n');
}
for (var i = 0; i < max; i++) {
stdout(i);
stderr(i);
}
process.exit(errorCode);
stdout('fail');
stderr('fail');

25
node_modules/exit/test/fixtures/log.js generated vendored Normal file
View file

@ -0,0 +1,25 @@
var exit = require('../../lib/exit');
var errorCode = process.argv[2];
var max = process.argv[3];
var modes = process.argv.slice(4);
function stdout(message) {
if (modes.indexOf('stdout') === -1) { return; }
process.stdout.write('stdout ' + message + '\n');
}
function stderr(message) {
if (modes.indexOf('stderr') === -1) { return; }
process.stderr.write('stderr ' + message + '\n');
}
for (var i = 0; i < max; i++) {
stdout(i);
stderr(i);
}
exit(errorCode);
stdout('fail');
stderr('fail');