Commit 8d3fab57 authored by Jérémy Lal's avatar Jérémy Lal

Imported Upstream version 5.8.0~dfsg

parent 2a55e5ab
......@@ -4,7 +4,7 @@ env:
rules:
# Possible Errors
# https://github.com/eslint/eslint/tree/master/docs/rules#possible-errors
# http://eslint.org/docs/rules/#possible-errors
comma-dangle: [2, "only-multiline"]
no-control-regex: 2
no-debugger: 2
......@@ -14,6 +14,7 @@ rules:
no-empty-character-class: 2
no-ex-assign: 2
no-extra-boolean-cast : 2
no-extra-parens: [2, "functions"]
no-extra-semi: 2
no-func-assign: 2
no-invalid-regexp: 2
......@@ -27,12 +28,17 @@ rules:
valid-typeof: 2
# Best Practices
# https://github.com/eslint/eslint/tree/master/docs/rules#best-practices
# http://eslint.org/docs/rules/#best-practices
no-fallthrough: 2
no-octal: 2
no-redeclare: 2
no-self-assign: 2
no-unused-labels: 2
# Strict Mode
# http://eslint.org/docs/rules/#strict-mode
strict: [2, "global"]
# Variables
# http://eslint.org/docs/rules/#variables
no-delete-var: 2
......@@ -47,7 +53,7 @@ rules:
no-restricted-modules: [2, "sys", "_linklist"]
# Stylistic Issues
# https://github.com/eslint/eslint/tree/master/docs/rules#stylistic-issues
# http://eslint.org/docs/rules/#stylistic-issues
comma-spacing: 2
eol-last: 2
indent: [2, 2, {SwitchCase: 1}]
......@@ -78,10 +84,6 @@ rules:
no-this-before-super: 2
prefer-const: 2
# Strict Mode
# https://github.com/eslint/eslint/tree/master/docs/rules#strict-mode
strict: [2, "global"]
# Custom rules in tools/eslint-rules
new-with-error: [2, "Error", "RangeError", "TypeError", "SyntaxError", "ReferenceError"]
......
# Node.js ChangeLog
## 2016-03-08, Version 5.8.0 (Stable). @Fishrock123
### Notable changes
* **child_process**: `send()` now accepts an options parameter (cjihrig) [#5283](https://github.com/nodejs/node/pull/5283).
- Currently the only option is `keepOpen`, which keeps the underlying socket open after the message is sent.
* **constants**: `ENGINE_METHOD_RSA` is now correctly exposed (Sam Roberts) [#5463](https://github.com/nodejs/node/pull/5463).
* Fixed two regressions which originated in v5.7.0:
- **http**: Errors inside of http client callbacks now propagate correctly (Trevor Norris) [#5591](https://github.com/nodejs/node/pull/5591).
- **path**: Fixed normalization of absolute paths (Evan Lucas) [#5589](https://github.com/nodejs/node/pull/5589).
* **repl**: `start()` no longer requires an options parameter (cjihrig) [#5388](https://github.com/nodejs/node/pull/5388).
* **util**: Improved `format()` performance 50-300% (Evan Lucas) [#5360](https://github.com/nodejs/node/pull/5360).
### Commits
* [[`12ca84fc7f`](https://github.com/nodejs/node/commit/12ca84fc7f)] - **benchmark**: add util.format benchmark (Evan Lucas) [#5360](https://github.com/nodejs/node/pull/5360)
* [[`b955d02266`](https://github.com/nodejs/node/commit/b955d02266)] - **benchmark**: fix lint errors (Rich Trott) [#5517](https://github.com/nodejs/node/pull/5517)
* [[`2abf866b6e`](https://github.com/nodejs/node/commit/2abf866b6e)] - **build**: update Node.js logo on Win installer (Robert Jefe Lindstaedt) [#5531](https://github.com/nodejs/node/pull/5531)
* [[`86900f8f2b`](https://github.com/nodejs/node/commit/86900f8f2b)] - **build**: correctly detect clang version (Stefan Budeanu) [#5553](https://github.com/nodejs/node/pull/5553)
* [[`a3017992e4`](https://github.com/nodejs/node/commit/a3017992e4)] - **(SEMVER-MINOR)** **child_process**: add keepOpen option to send() (cjihrig) [#5283](https://github.com/nodejs/node/pull/5283)
* [[`6d4887ccc2`](https://github.com/nodejs/node/commit/6d4887ccc2)] - **(SEMVER-MINOR)** **child_process**: support options in send() (cjihrig) [#5283](https://github.com/nodejs/node/pull/5283)
* [[`9db827c7aa`](https://github.com/nodejs/node/commit/9db827c7aa)] - **(SEMVER-MINOR)** **constants**: define ENGINE_METHOD_RSA (Sam Roberts) [#5463](https://github.com/nodejs/node/pull/5463)
* [[`85013456cd`](https://github.com/nodejs/node/commit/85013456cd)] - **deps**: upgrade to npm 3.7.3 (Kat Marchán) [#5369](https://github.com/nodejs/node/pull/5369)
* [[`67e9f65958`](https://github.com/nodejs/node/commit/67e9f65958)] - **dgram**: default send address to 127.0.0.1 or ::1 (Matteo Collina) [#5493](https://github.com/nodejs/node/pull/5493)
* [[`3c92352c8c`](https://github.com/nodejs/node/commit/3c92352c8c)] - **doc**: document directories in test directory (Michael Barrett) [#5557](https://github.com/nodejs/node/pull/5557)
* [[`7be726f86a`](https://github.com/nodejs/node/commit/7be726f86a)] - **doc**: add info to docs on how to submit docs patch (Sequoia McDowell) [#4591](https://github.com/nodejs/node/pull/4591)
* [[`eb5a95e04a`](https://github.com/nodejs/node/commit/eb5a95e04a)] - **doc**: fix typo in fs.symlink (Michaël Zasso) [#5560](https://github.com/nodejs/node/pull/5560)
* [[`9ad901ef44`](https://github.com/nodejs/node/commit/9ad901ef44)] - **doc**: improve unhandledException doc copy (James M Snell) [#5287](https://github.com/nodejs/node/pull/5287)
* [[`3bd96fdb0f`](https://github.com/nodejs/node/commit/3bd96fdb0f)] - **doc**: update link green to match homepage (silverwind) [#5548](https://github.com/nodejs/node/pull/5548)
* [[`cb7e4fbac9`](https://github.com/nodejs/node/commit/cb7e4fbac9)] - **doc**: update V8 URL (Craig Akimoto) [#5530](https://github.com/nodejs/node/pull/5530)
* [[`b54a26fa61`](https://github.com/nodejs/node/commit/b54a26fa61)] - **(SEMVER-MINOR)** **doc**: correct name of engine methods (Sam Roberts) [#5463](https://github.com/nodejs/node/pull/5463)
* [[`f3971f5817`](https://github.com/nodejs/node/commit/f3971f5817)] - **path**: fix normalize for absolutes (Evan Lucas) [#5589](https://github.com/nodejs/node/pull/5589)
* [[`e572e421b4`](https://github.com/nodejs/node/commit/e572e421b4)] - **(SEMVER-MINOR)** **repl**: accept no arguments to start() (cjihrig) [#5388](https://github.com/nodejs/node/pull/5388)
* [[`5e6d706758`](https://github.com/nodejs/node/commit/5e6d706758)] - **src,http**: fix uncaughtException miss in http (Trevor Norris) [#5591](https://github.com/nodejs/node/pull/5591)
* [[`9dc94d7b09`](https://github.com/nodejs/node/commit/9dc94d7b09)] - **test**: add test-npm-install to parallel tests suite (Myles Borins) [#5166](https://github.com/nodejs/node/pull/5166)
* [[`4f20f31b3e`](https://github.com/nodejs/node/commit/4f20f31b3e)] - **test**: remove broken debugger scenarios (Rich Trott) [#5532](https://github.com/nodejs/node/pull/5532)
* [[`29e26b38c5`](https://github.com/nodejs/node/commit/29e26b38c5)] - **test**: bug repro for vm function redefinition (cjihrig) [#5528](https://github.com/nodejs/node/pull/5528)
* [[`e6210d5f50`](https://github.com/nodejs/node/commit/e6210d5f50)] - **test**: prevent flakey test on pi2 (Trevor Norris) [#5537](https://github.com/nodejs/node/pull/5537)
* [[`40b36baa2f`](https://github.com/nodejs/node/commit/40b36baa2f)] - **test**: check memoryUsage properties (Wyatt Preul) [#5546](https://github.com/nodejs/node/pull/5546)
* [[`048c0f4738`](https://github.com/nodejs/node/commit/048c0f4738)] - **tools**: reduce verbosity of cpplint (Sakthipriyan Vairamani) [#5578](https://github.com/nodejs/node/pull/5578)
* [[`7965c897e0`](https://github.com/nodejs/node/commit/7965c897e0)] - **tools**: enable no-self-assign ESLint rule (Rich Trott) [#5552](https://github.com/nodejs/node/pull/5552)
* [[`5aa17dc136`](https://github.com/nodejs/node/commit/5aa17dc136)] - **tools**: support testing known issues (cjihrig) [#5528](https://github.com/nodejs/node/pull/5528)
* [[`9a3e87e9a8`](https://github.com/nodejs/node/commit/9a3e87e9a8)] - **tools**: enable linting for benchmarks (Rich Trott) [#5517](https://github.com/nodejs/node/pull/5517)
* [[`c4fa2a6715`](https://github.com/nodejs/node/commit/c4fa2a6715)] - **tools**: enable no-extra-parens in ESLint (Rich Trott) [#5512](https://github.com/nodejs/node/pull/5512)
* [[`971edde0cb`](https://github.com/nodejs/node/commit/971edde0cb)] - **util**: improve format() performance further (Brian White) [#5360](https://github.com/nodejs/node/pull/5360)
* [[`c32d460747`](https://github.com/nodejs/node/commit/c32d460747)] - **util**: improve util.format performance (Evan Lucas) [#5360](https://github.com/nodejs/node/pull/5360)
## 2016-03-02, Version 5.7.1 (Stable), @Fishrock123
### Notable changes
......
......@@ -192,6 +192,9 @@ test-internet: all
test-debugger: all
$(PYTHON) tools/test.py debugger
test-known-issues: all
$(PYTHON) tools/test.py known_issues --expect-fail
test-npm: $(NODE_EXE)
NODE=$(NODE) tools/test-npm.sh
......@@ -578,8 +581,8 @@ bench-idle:
$(NODE) benchmark/idle_clients.js &
jslint:
$(NODE) tools/eslint/bin/eslint.js lib src test tools/doc tools/eslint-rules \
--rulesdir tools/eslint-rules
$(NODE) tools/eslint/bin/eslint.js benchmark lib src test tools/doc \
tools/eslint-rules --rulesdir tools/eslint-rules
CPPLINT_EXCLUDE ?=
CPPLINT_EXCLUDE += src/node_lttng.cc
......
'use strict';
var common = require('../common.js');
var bench = common.createBenchmark(main, {
type: 'Array Buffer Int8Array Uint8Array Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array'.split(' '),
type: ['Array', 'Buffer', 'Int8Array', 'Uint8Array', 'Int16Array',
'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array',
'Float64Array'],
n: [25]
});
......
'use strict';
var common = require('../common.js');
var bench = common.createBenchmark(main, {
type: 'Array Buffer Int8Array Uint8Array Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array'.split(' '),
type: ['Array', 'Buffer', 'Int8Array', 'Uint8Array', 'Int16Array',
'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array',
'Float64Array'],
n: [25]
});
......
'use strict';
var common = require('../common.js');
var bench = common.createBenchmark(main, {
type: 'Array Buffer Int8Array Uint8Array Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array'.split(' '),
type: ['Array', 'Buffer', 'Int8Array', 'Uint8Array', 'Int16Array',
'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array',
'Float64Array'],
n: [25]
});
......
'use strict';
var assert = require('assert');
var common = require('../common.js');
const assert = require('assert');
const common = require('../common.js');
var bench = common.createBenchmark(main, {});
const bench = common.createBenchmark(main, {});
function main(conf) {
for (var s = 'abcd'; s.length < 32 << 20; s += s);
const s = 'abcd'.repeat(8 << 20);
s.match(/./); // Flatten string.
assert.equal(s.length % 4, 0);
var b = Buffer(s.length / 4 * 3);
const b = Buffer(s.length / 4 * 3);
b.write(s, 0, s.length, 'base64');
bench.start();
for (var i = 0; i < 32; i += 1) b.base64Write(s, 0, s.length);
......
......@@ -14,7 +14,7 @@ function main(conf) {
var clazz = conf.type === 'fast' ? Buffer : SlowBuffer;
bench.start();
for (var i = 0; i < n * 1024; i++) {
b = new clazz(len);
new clazz(len);
}
bench.end(n);
}
'use strict';
var common = require('../common.js');
var fs = require('fs');
const path = require('path');
var bench = common.createBenchmark(main, {
search: ['@', 'SQ', '10x', '--l', 'Alice', 'Gryphon', 'Panther',
......@@ -15,7 +16,9 @@ var bench = common.createBenchmark(main, {
function main(conf) {
var iter = (conf.iter) * 100000;
var aliceBuffer = fs.readFileSync(__dirname + '/../fixtures/alice.html');
var aliceBuffer = fs.readFileSync(
path.resolve(__dirname, '../fixtures/alice.html')
);
var search = conf.search;
var encoding = conf.encoding;
......
......@@ -77,10 +77,15 @@ function run() {
var out = '';
var child;
if (Array.isArray(benchmarks) && benchmarks.length)
child = spawn(node, ['benchmark/common.js'].concat(benchmarks), { env: env });
else
if (Array.isArray(benchmarks) && benchmarks.length) {
child = spawn(
node,
['benchmark/common.js'].concat(benchmarks),
{ env: env }
);
} else {
child = spawn('make', [runBench], { env: env });
}
child.stdout.setEncoding('utf8');
child.stdout.on('data', function(c) {
out += c;
......@@ -136,8 +141,18 @@ function compare() {
if (show === 'green' && !g || show === 'red' && !r)
return;
var r0 = util.format('%s%s: %d%s', g, nodes[0], n0.toPrecision(5), g ? reset : '');
var r1 = util.format('%s%s: %d%s', r, nodes[1], n1.toPrecision(5), r ? reset : '');
var r0 = util.format(
'%s%s: %d%s',
g,
nodes[0],
n0.toPrecision(5), g ? reset : ''
);
var r1 = util.format(
'%s%s: %d%s',
r,
nodes[1],
n1.toPrecision(5), r ? reset : ''
);
pct = c + pct + '%' + reset;
var l = util.format('%s: %s %s', bench, r0, r1);
maxLen = Math.max(l.length + pct.length, maxLen);
......
......@@ -20,9 +20,9 @@ function main(conf) {
for (var i = 0; i < n; i++) {
if (myArguments.length >= 2) {
args = Array.prototype.slice.call(myArguments, 1);
ret = fn.apply(this, args);
fn.apply(this, args);
} else {
ret = fn.call(this);
fn.call(this);
}
}
bdomain.exit();
......
......@@ -2,6 +2,7 @@
const common = require('../common');
const fs = require('fs');
const path = require('path');
const bench = common.createBenchmark(main, {
n: [1e4],
......@@ -15,7 +16,7 @@ function main(conf) {
(function r(cntr) {
if (--cntr <= 0)
return bench.end(n);
fs.readdir(__dirname + '/../../lib/', function() {
fs.readdir(path.resolve(__dirname, '../../lib/'), function() {
r(cntr);
});
}(n));
......
......@@ -2,6 +2,7 @@
const common = require('../common');
const fs = require('fs');
const path = require('path');
const bench = common.createBenchmark(main, {
n: [1e4],
......@@ -13,7 +14,7 @@ function main(conf) {
bench.start();
for (var i = 0; i < n; i++) {
fs.readdirSync(__dirname + '/../../lib/');
fs.readdirSync(path.resolve(__dirname, '../../lib/'));
}
bench.end(n);
}
......@@ -111,10 +111,10 @@ server.listen(port, function() {
});
function dump_mm_stats() {
if (typeof gc != 'function') return;
if (typeof global.gc != 'function') return;
var before = process.memoryUsage();
for (var i = 0; i < 10; ++i) gc();
for (var i = 0; i < 10; ++i) global.gc();
var after = process.memoryUsage();
setTimeout(print_stats, 250); // give GC time to settle
......
'use strict';
var cluster = require('cluster');
var os = require('os');
const cluster = require('cluster');
const os = require('os');
const path = require('path');
if (cluster.isMaster) {
console.log('master running on pid %d', process.pid);
for (var i = 0, n = os.cpus().length; i < n; ++i) cluster.fork();
} else {
require(__dirname + '/http_simple.js');
require(path.join(__dirname, 'http_simple.js'));
}
......@@ -17,7 +17,6 @@ function connect() {
s.on('close', function() {
if (gotConnected) connections--;
lastClose = new Date();
});
s.on('error', function() {
......
......@@ -22,7 +22,7 @@ function main(conf) {
bench.start();
for (i = 0; i < n; i++){
for (i = 0; i < n; i++) {
// Return all the items to the pool
for (j = 0; j < poolSize; j++) {
list.free(used[j]);
......
......@@ -20,4 +20,4 @@ global.load = function(filename) {
global.RegExp = $RegExp;
};
load('run.js');
global.load('run.js');
......@@ -18,8 +18,14 @@ function main(conf) {
var n = +conf.thousands * 1e3;
for (var i = 0; i <= n; i++) {
fs.mkdirSync(benchmarkDirectory + i);
fs.writeFileSync(benchmarkDirectory + i + '/package.json', '{"main": "index.js"}');
fs.writeFileSync(benchmarkDirectory + i + '/index.js', 'module.exports = "";');
fs.writeFileSync(
benchmarkDirectory + i + '/package.json',
'{"main": "index.js"}'
);
fs.writeFileSync(
benchmarkDirectory + i + '/index.js',
'module.exports = "";'
);
}
measure(n);
......
......@@ -45,9 +45,10 @@ function main(conf) {
server = tls.createServer(options, onConnection);
setTimeout(done, dur * 1000);
var conn;
server.listen(common.PORT, function() {
var opt = { port: common.PORT, rejectUnauthorized: false };
var conn = tls.connect(opt, function() {
conn = tls.connect(opt, function() {
bench.start();
conn.on('drain', write);
write();
......@@ -68,7 +69,8 @@ function main(conf) {
function done() {
var mbits = (received * 8) / (1024 * 1024);
bench.end(mbits);
conn.destroy();
if (conn)
conn.destroy();
server.close();
}
}
......
'use strict';
const util = require('util');
const common = require('../common');
const v8 = require('v8');
const bench = common.createBenchmark(main, {
n: [1e6]
, type: ['string',
'number',
'object',
'unknown',
'no-replace']
});
const inputs = {
'string': ['Hello, my name is %s', 'fred'],
'number': ['Hi, I was born in %d', 1942],
'object': ['An error occurred %j', {msg: 'This is an error', code: 'ERR'}],
'unknown': ['hello %a', 'test'],
'no-replace': [1, 2]
};
function main(conf) {
const n = conf.n | 0;
const type = conf.type;
const input = inputs[type];
v8.setFlagsFromString('--allow_natives_syntax');
util.format(input[0], input[1]);
eval('%OptimizeFunctionOnNextCall(util.format)');
util.format(input[0], input[1]);
bench.start();
for (var i = 0; i < n; i++) {
util.format(input[0], input[1]);
}
bench.end(n);
}
......@@ -441,7 +441,7 @@ def try_check_compiler(cc, lang):
# Commands and regular expressions to obtain its version number are taken from
# https://github.com/openssl/openssl/blob/OpenSSL_1_0_2-stable/crypto/sha/asm/sha512-x86_64.pl#L112-L129
#
def get_llvm_version(cc):
def get_version_helper(cc, regexp):
try:
proc = subprocess.Popen(shlex.split(cc) + ['-v'], stdin=subprocess.PIPE,
stderr=subprocess.PIPE, stdout=subprocess.PIPE)
......@@ -454,14 +454,20 @@ def get_llvm_version(cc):
'''
sys.exit()
match = re.search(r"(^clang version|based on LLVM) ([3-9]\.[0-9]+)",
proc.communicate()[1])
match = re.search(regexp, proc.communicate()[1])
if match:
return match.group(2)
else:
return 0
def get_llvm_version(cc):
return get_version_helper(
cc, r"(^clang version|based on LLVM) ([3-9]\.[0-9]+)")
def get_xcode_version(cc):
return get_version_helper(
cc, r"(^Apple LLVM version) ([5-9]\.[0-9]+)")
def get_gas_version(cc):
try:
......@@ -516,6 +522,8 @@ def check_compiler(o):
if is_clang:
o['variables']['llvm_version'] = get_llvm_version(CC)
if sys.platform == 'darwin':
o['variables']['xcode_version'] = get_xcode_version(CC)
else:
o['variables']['gas_version'] = get_gas_version(CC)
......
......@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title> Node.js v5.7.1 Manual &amp; Documentation</title>
<title> Node.js v5.8.0 Manual &amp; Documentation</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic">
<link rel="stylesheet" href="assets/style.css">
<link rel="stylesheet" href="assets/sh.css">
......@@ -61,7 +61,7 @@
<div id="column1" data-id="_toc" class="interior">
<header>
<h1>Node.js v5.7.1 Documentation</h1>
<h1>Node.js v5.8.0 Documentation</h1>
<div id="gtoc">
<p>
<a href="index.html" name="toc">Index</a> |
......
......@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>Addons Node.js v5.7.1 Manual &amp; Documentation</title>
<title>Addons Node.js v5.8.0 Manual &amp; Documentation</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic">
<link rel="stylesheet" href="assets/style.css">
<link rel="stylesheet" href="assets/sh.css">
......@@ -61,7 +61,7 @@
<div id="column1" data-id="addons" class="interior">
<header>
<h1>Node.js v5.7.1 Documentation</h1>
<h1>Node.js v5.8.0 Documentation</h1>
<div id="gtoc">
<p>
<a href="index.html" name="toc">Index</a> |
......
This diff is collapsed.
This diff is collapsed.
......@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>Assert Node.js v5.7.1 Manual &amp; Documentation</title>
<title>Assert Node.js v5.8.0 Manual &amp; Documentation</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic">
<link rel="stylesheet" href="assets/style.css">
<link rel="stylesheet" href="assets/sh.css">
......@@ -61,7 +61,7 @@
<div id="column1" data-id="assert" class="interior">
<header>
<h1>Node.js v5.7.1 Documentation</h1>
<h1>Node.js v5.8.0 Documentation</h1>
<div id="gtoc">
<p>
<a href="index.html" name="toc">Index</a> |
......
......@@ -33,7 +33,7 @@ pre, tt, code, .pre, span.type, a.type {
}
a, a:link, a:active {
color: #80bd01;
color: #43853d;
text-decoration: none;
border-radius: 2px;
padding: .1em .2em;
......@@ -42,7 +42,7 @@ a, a:link, a:active {
a:hover, a:focus {
color: #fff;
background-color: #80bd01;
background-color: #43853d;
outline: none;
}
......@@ -413,13 +413,14 @@ a code {
#column2 ul li a.active, #column2 ul li a.active:hover,
#column2 ul li a.active:focus {
color: #80bd01;
color: #43853d;
border-radius: 0;
border-bottom: 1px solid #80bd01;
border-bottom: 1px solid #43853d;
background: none;
}
#intro a:hover, #column2 ul li a:hover, #column2 ul li a:focus {
#intro a:hover, #intro a:focus,
#column2 ul li a:hover, #column2 ul li a:focus {
color: #fff;
background: none;
}
......@@ -433,7 +434,7 @@ span > .mark, span > .mark:visited {
}
span > .mark:hover, span > .mark:focus, span > .mark:active {
color: #80bd01;
color: #43853d;
background: none;
}
......
......@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>Buffer Node.js v5.7.1 Manual &amp; Documentation</title>
<title>Buffer Node.js v5.8.0 Manual &amp; Documentation</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic">
<link rel="stylesheet" href="assets/style.css">
<link rel="stylesheet" href="assets/sh.css">
......@@ -61,7 +61,7 @@
<div id="column1" data-id="buffer" class="interior">
<header>
<h1>Node.js v5.7.1 Documentation</h1>
<h1>Node.js v5.8.0 Documentation</h1>
<div id="gtoc">
<p>
<a href="index.html" name="toc">Index</a> |
......
......@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>Child Process Node.js v5.7.1 Manual &amp; Documentation</title>
<title>Child Process Node.js v5.8.0 Manual &amp; Documentation</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic">
<link rel="stylesheet" href="assets/style.css">
<link rel="stylesheet" href="assets/sh.css">
......@@ -61,7 +61,7 @@
<div id="column1" data-id="child_process" class="interior">
<header>
<h1>Node.js v5.7.1 Documentation</h1>
<h1>Node.js v5.8.0 Documentation</h1>
<div id="gtoc">
<p>
<a href="index.html" name="toc">Index</a> |
......@@ -104,7 +104,7 @@
<li><a href="#child_process_child_disconnect">child.disconnect()</a></li>
<li><a href="#child_process_child_kill_signal">child.kill([signal])</a></li>
<li><a href="#child_process_child_pid">child.pid</a></li>
<li><a href="#child_process_child_send_message_sendhandle_callback">child.send(message[, sendHandle][, callback])</a><ul>
<li><a href="#child_process_child_send_message_sendhandle_options_callback">child.send(message[, sendHandle[, options]][, callback])</a><ul>
<li><a href="#child_process_example_sending_a_server_object">Example: sending a server object</a></li>
<li><a href="#child_process_example_sending_a_socket_object">Example: sending a socket object</a></li>
</ul>
......@@ -925,10 +925,11 @@ const grep = spawn(&#39;grep&#39;, [&#39;ssh&#39;]);
console.log(`Spawned child pid: ${grep.pid}`);
grep.stdin.end();</code></pre>
<h3>child.send(message[, sendHandle][, callback])<span><a class="mark" href="#child_process_child_send_message_sendhandle_callback" id="child_process_child_send_message_sendhandle_callback">#</a></span></h3>
<h3>child.send(message[, sendHandle[, options]][, callback])<span><a class="mark" href="#child_process_child_send_message_sendhandle_options_callback" id="child_process_child_send_message_sendhandle_options_callback">#</a></span></h3>
<div class="signature"><ul>
<li><code>message</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&lt;Object&gt;</a></li>
<li><code>sendHandle</code> <a href="net.html#net_server_listen_handle_backlog_callback" class="type">&lt;Handle&gt;</a></li>
<li><code>options</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&lt;Object&gt;</a></li>
<li><code>callback</code> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function" class="type">&lt;Function&gt;</a></li>
<li>Return: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type" class="type">&lt;Boolean&gt;</a></li>
</div></ul>
......@@ -976,6 +977,16 @@ receive the object as the second argument passed to the callback function
registered on the <code>process.on(&#39;message&#39;)</code> event.
</p>
<p>The <code>options</code> argument, if present, is an object used to parameterize the
sending of certain types of handles. <code>options</code> supports the following
properties:
</p>
<ul>
<li><code>keepOpen</code> - A Boolean value that can be used when passing instances of
<code>net.Socket</code>. When <code>true</code>, the socket is kept open in the sending process.
Defaults to <code>false</code>.</li>
</ul>
<p>The optional <code>callback</code> is a function that is invoked after the message is
sent but before the child may have received it. The function is called with a
single argument: <code>null</code> on success, or an <a href="errors.html#errors_class_error"><code>Error</code></a> object on failure.
......
This diff is collapsed.
......@@ -750,10 +750,11 @@ console.log(`Spawned child pid: ${grep.pid}`);
grep.stdin.end();
```
### child.send(message[, sendHandle][, callback])
### child.send(message[, sendHandle[, options]][, callback])
* `message` {Object}
* `sendHandle` {Handle}
* `options` {Object}
* `callback` {Function}
* Return: {Boolean}
......@@ -801,6 +802,14 @@ passing a TCP server or socket object to the child process. The child will
receive the object as the second argument passed to the callback function
registered on the `process.on('message')` event.
The `options` argument, if present, is an object used to parameterize the
sending of certain types of handles. `options` supports the following
properties:
* `keepOpen` - A Boolean value that can be used when passing instances of
`net.Socket`. When `true`, the socket is kept open in the sending process.
Defaults to `false`.
The optional `callback` is a function that is invoked after the message is
sent but before the child may have received it. The function is called with a
single argument: `null` on success, or an [`Error`][] object on failure.
......