Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Merge branch 'v0.10'
Browse files Browse the repository at this point in the history
Conflicts:
	tools/test.py
  • Loading branch information
piscisaureus committed May 13, 2013
2 parents 8db693a + 21bd456 commit bdc5881
Show file tree
Hide file tree
Showing 19 changed files with 242 additions and 90 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Resources for Newcomers
- [nodejs.org](http://nodejs.org/)
- [how to install node.js and npm (node package manager)](http://joyeur.com/2010/12/10/installing-node-and-npm/)
- [list of modules](https://github.com/joyent/node/wiki/modules)
- [searching the npm registry](http://search.npmjs.org/)
- [searching the npm registry](http://npmjs.org/)
- [list of companies and projects using node](https://github.com/joyent/node/wiki/Projects,-Applications,-and-Companies-Using-Node)
- [node.js mailing list](http://groups.google.com/group/nodejs)
- irc chatroom, [#node.js on freenode.net](http://webchat.freenode.net?channels=node.js&uio=d4)
Expand Down
4 changes: 2 additions & 2 deletions doc/about/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<li><a href="/" class="home">Home</a></li>
<li><a href="/download/" class="download">Download</a></li>
<li><a href="/about/" class="about current">About</a></li>
<li><a href="http://search.npmjs.org/" class="npm">npm Registry</a></li>
<li><a href="http://npmjs.org/" class="npm">npm Registry</a></li>
<li><a href="http://nodejs.org/api/" class="docs">Docs</a></li>
<li><a href="http://blog.nodejs.org" class="blog">Blog</a></li>
<li><a href="/community/" class="community">Community</a></li>
Expand Down Expand Up @@ -116,7 +116,7 @@ <h1>Node's goal is to provide an easy way to build scalable
<li><a href="/">Node.js</a></li>
<li><a href="/#download">Download</a></li>
<li><a href="/about/">About</a></li>
<li><a href="http://search.npmjs.org/">npm Registry</a></li>
<li><a href="http://npmjs.org/">npm Registry</a></li>
<li><a href="http://nodejs.org/api/">Docs</a></li>
<li><a href="http://blog.nodejs.org">Blog</a></li>
<li><a href="/community/">Community</a></li>
Expand Down
8 changes: 0 additions & 8 deletions doc/api/child_process.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -466,11 +466,6 @@ See also: `child_process.exec()` and `child_process.fork()`
* `command` {String} The command to run, with space-separated arguments
* `options` {Object}
* `cwd` {String} Current working directory of the child process
* `stdio` {Array|String} Child's stdio configuration. (See above)
Only stdin is configurable, anything else will lead to unpredictable
results.
* `customFds` {Array} **Deprecated** File descriptors for the child to use
for stdio. (See above)
* `env` {Object} Environment key-value pairs
* `encoding` {String} (Default: 'utf8')
* `timeout` {Number} (Default: 0)
Expand Down Expand Up @@ -524,9 +519,6 @@ the child process is killed.
* `args` {Array} List of string arguments
* `options` {Object}
* `cwd` {String} Current working directory of the child process
* `stdio` {Array|String} Child's stdio configuration. (See above)
* `customFds` {Array} **Deprecated** File descriptors for the child to use
for stdio. (See above)
* `env` {Object} Environment key-value pairs
* `encoding` {String} (Default: 'utf8')
* `timeout` {Number} (Default: 0)
Expand Down
4 changes: 4 additions & 0 deletions doc/api/stream.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,10 @@ Emitted when the stream's write queue empties and it's safe to write
without buffering again. Listen for it when `stream.write()` returns
`false`.
### Event: 'error'
Emitted if there was an error receiving data.
### Event: 'close'
Emitted when the underlying resource (for example, the backing file
Expand Down
4 changes: 2 additions & 2 deletions doc/blog.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@

<li><a href="http://nodejs.org/about/" class="about">About</a></li>

<li><a href="http://search.npmjs.org/" class="npm">npm
<li><a href="http://npmjs.org/" class="npm">npm
Registry</a></li>

<li><a href="http://nodejs.org/api/" class="docs">Docs</a></li>
Expand Down Expand Up @@ -213,7 +213,7 @@ <h1><a href="<%=
<li><a href="http://nodejs.org/">Node.js</a></li>
<li><a href="http://nodejs.org/download/">Download</a></li>
<li><a href="http://nodejs.org/about/">About</a></li>
<li><a href="http://search.npmjs.org/">npm Registry</a></li>
<li><a href="http://npmjs.org/">npm Registry</a></li>
<li><a href="http://nodejs.org/api/">Docs</a></li>
<li><a href="http://blog.nodejs.org">Blog</a></li>
<li><a href="http://nodejs.org/community/">Community</a></li>
Expand Down
17 changes: 14 additions & 3 deletions doc/blog/Uncategorized/version-0-6.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,19 @@ status: publish
category: Uncategorized
slug: version-0-6

Version 0.6.0 will be released next week. Please spend some time this week upgrading your code to v0.5.10. Report any API differences at <a href="https://github.com/joyent/node/wiki/API-changes-between-v0.4-and-v0.6">https://github.com/joyent/node/wiki/API-changes-between-v0.4-and-v0.6</a> or report a bug to us at <a href="http://github.com/joyent/node/issues">http://github.com/joyent/node/issues</a> if you hit problems.
Version 0.6.0 will be released next week. Please spend some time this
week upgrading your code to v0.5.10. Report any API differences at <a
href="https://github.com/joyent/node/wiki/API-changes-between-v0.4-and-v0.6">https://github.com/joyent/node/wiki/API-changes-between-v0.4-and-v0.6</a>
or report a bug to us at <a
href="http://github.com/joyent/node/issues">http://github.com/joyent/node/issues</a>
if you hit problems.

The API changes between v0.4.12 and v0.5.10 are 99% cosmetic, minor, and easy to fix. Most people are able to migrate their code in 10 minutes. Don't fear.
The API changes between v0.4.12 and v0.5.10 are 99% cosmetic, minor,
and easy to fix. Most people are able to migrate their code in 10
minutes. Don't fear.

Once you've ported your code to v0.5.10 please help out by testing third party modules. Make bug reports. Encourage authors to publish new versions of their modules. Go through the list of modules at <a href="http://search.npmjs.org/">http://search.npmjs.org/</a> and try out random ones. This is especially encouraged of Windows users!
Once you've ported your code to v0.5.10 please help out by testing
third party modules. Make bug reports. Encourage authors to publish
new versions of their modules. Go through the list of modules at <a
href="http://npmjs.org/">http://npmjs.org/</a> and try out random
ones. This is especially encouraged of Windows users!
2 changes: 1 addition & 1 deletion doc/changelog-foot.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<li><a href="/">Node.js</a></li>
<li><a href="/download/">Download</a></li>
<li><a href="/about/">About</a></li>
<li><a href="http://search.npmjs.org/">npm Registry</a></li>
<li><a href="http://npmjs.org/">npm Registry</a></li>
<li><a href="http://nodejs.org/api/">Docs</a></li>
<li><a href="http://blog.nodejs.org">Blog</a></li>
<li><a href="/community/">Community</a></li>
Expand Down
2 changes: 1 addition & 1 deletion doc/changelog-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<li><a href="/" class="home">Home</a></li>
<li><a href="/download/" class="download">Download</a></li>
<li><a href="/about/" class="about">About</a></li>
<li><a href="http://search.npmjs.org/" class="npm">npm Registry</a></li>
<li><a href="http://npmjs.org/" class="npm">npm Registry</a></li>
<li><a href="http://nodejs.org/api/" class="docs current">Docs</a></li>
<li><a href="http://blog.nodejs.org" class="blog">Blog</a></li>
<li><a href="/community/" class="community">Community</a></li>
Expand Down
6 changes: 3 additions & 3 deletions doc/community/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<li><a href="/" class="home">Home</a></li>
<li><a href="/download/" class="download">Download</a></li>
<li><a href="/about/" class="about">About</a></li>
<li><a href="http://search.npmjs.org/" class="npm">npm Registry</a></li>
<li><a href="http://npmjs.org/" class="npm">npm Registry</a></li>
<li><a href="http://nodejs.org/api/" class="docs">Docs</a></li>
<li><a href="http://blog.nodejs.org" class="blog">Blog</a></li>
<li><a href="/community/" class="community current">Community</a></li>
Expand Down Expand Up @@ -93,7 +93,7 @@ <h2 class="github">GitHub</h2>
Projects, Applications, and Companies Using Node</a> or the
<a href="https://github.com/joyent/node/wiki/modules">very long
list of Node modules</a>, many of which are published in the
<a href="http://search.npmjs.org/">npm registry</a>.
<a href="http://npmjs.org/">npm registry</a>.
</p>
</div>
</div>
Expand Down Expand Up @@ -223,7 +223,7 @@ <h2 class="irc">IRC</h2>
<li><a href="/">Node.js</a></li>
<li><a href="/download/">Download</a></li>
<li><a href="/about/">About</a></li>
<li><a href="http://search.npmjs.org/">npm Registry</a></li>
<li><a href="http://npmjs.org/">npm Registry</a></li>
<li><a href="http://nodejs.org/api/">Docs</a></li>
<li><a href="http://blog.nodejs.org">Blog</a></li>
<li><a href="/community/">Community</a></li>
Expand Down
4 changes: 2 additions & 2 deletions doc/download/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<li><a href="/" class="home">Home</a></li>
<li><a href="/download/" class="download current">Download</a></li>
<li><a href="/about/" class="about">About</a></li>
<li><a href="http://search.npmjs.org/" class="npm">npm Registry</a></li>
<li><a href="http://npmjs.org/" class="npm">npm Registry</a></li>
<li><a href="http://nodejs.org/api/" class="docs">Docs</a></li>
<li><a href="http://blog.nodejs.org" class="blog">Blog</a></li>
<li><a href="/community/" class="community">Community</a></li>
Expand Down Expand Up @@ -162,7 +162,7 @@ <h2 id="license">License</h2>
<li><a href="/">Node.js</a></li>
<li><a href="/download/">Download</a></li>
<li><a href="/about/">About</a></li>
<li><a href="http://search.npmjs.org/">npm Registry</a></li>
<li><a href="http://npmjs.org/">npm Registry</a></li>
<li><a href="http://nodejs.org/api/">Docs</a></li>
<li><a href="http://blog.nodejs.org">Blog</a></li>
<li><a href="/community/">Community</a></li>
Expand Down
4 changes: 2 additions & 2 deletions doc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ <h2>Featured</h2>
<h2>Explore Node.js</h2>
<ul id="explore">
<li><a href="about/" class="explore">About</a><br><span>Technical overview</span></li>
<li><a href="http://search.npmjs.org/" class="explore">npm Registry</a><br><span>Modules, resources and more</span></li>
<li><a href="http://npmjs.org/" class="explore">npm Registry</a><br><span>Modules, resources and more</span></li>
<li><a href="http://nodejs.org/api/" class="explore">Documentation</a><br><span>API Specifications</span></li>
<li><a href="http://blog.nodejs.org" class="explore">Node.js Blog</a><br><span>Insight, perspective and events</span></li>
<li><a href="community/" class="explore">Community</a><br><span>Mailing lists, blogs, and more</span></li>
Expand All @@ -134,7 +134,7 @@ <h2>Explore Node.js</h2>
<li><a href="/">Node.js</a></li>
<li><a href="/download/">Download</a></li>
<li><a href="/about/">About</a></li>
<li><a href="http://search.npmjs.org/">npm Registry</a></li>
<li><a href="http://npmjs.org/">npm Registry</a></li>
<li><a href="http://nodejs.org/api/">Docs</a></li>
<li><a href="http://blog.nodejs.org">Blog</a></li>
<li><a href="/community/">Community</a></li>
Expand Down
4 changes: 2 additions & 2 deletions doc/logos/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<li><a href="/" class="home">Home</a></li>
<li><a href="/#download" class="download">Download</a></li>
<li><a href="/about/" class="about">About</a></li>
<li><a href="http://search.npmjs.org/" class="npm">npm Registry</a></li>
<li><a href="http://npmjs.org/" class="npm">npm Registry</a></li>
<li><a href="http://nodejs.org/api/" class="docs">Docs</a></li>
<li><a href="http://blog.nodejs.org" class="blog">Blog</a></li>
<li><a href="/community/" class="community">Community</a></li>
Expand Down Expand Up @@ -68,7 +68,7 @@ <h2>Desktop Background</h2>
<li><a href="/">Node.js</a></li>
<li><a href="/#download">Download</a></li>
<li><a href="/about/">About</a></li>
<li><a href="http://search.npmjs.org/">npm Registry</a></li>
<li><a href="http://npmjs.org/">npm Registry</a></li>
<li><a href="http://nodejs.org/api/">Docs</a></li>
<li><a href="http://blog.nodejs.org">Blog</a></li>
<li><a href="/community/">Community</a></li>
Expand Down
4 changes: 2 additions & 2 deletions doc/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<li><a href="/" class="home">Home</a></li>
<li><a href="/download/" class="download">Download</a></li>
<li><a href="/about/" class="about">About</a></li>
<li><a href="http://search.npmjs.org/" class="npm">npm Registry</a></li>
<li><a href="http://npmjs.org/" class="npm">npm Registry</a></li>
<li><a href="http://nodejs.org/api/" class="docs current">Docs</a></li>
<li><a href="http://blog.nodejs.org" class="blog">Blog</a></li>
<li><a href="/community/" class="community">Community</a></li>
Expand Down Expand Up @@ -58,7 +58,7 @@ <h2>Table of Contents</h2>
<li><a href="/">Node.js</a></li>
<li><a href="/download/">Download</a></li>
<li><a href="/about/">About</a></li>
<li><a href="http://search.npmjs.org/">npm Registry</a></li>
<li><a href="http://npmjs.org/">npm Registry</a></li>
<li><a href="http://nodejs.org/api/">Docs</a></li>
<li><a href="http://blog.nodejs.org">Blog</a></li>
<li><a href="/community/">Community</a></li>
Expand Down
3 changes: 1 addition & 2 deletions lib/_stream_readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -759,15 +759,14 @@ Readable.prototype.wrap = function(stream) {
if (chunk && chunk.length)
self.push(chunk);
}
state.ended = true;

self.push(null);
});

stream.on('data', function(chunk) {
if (state.decoder)
chunk = state.decoder.write(chunk);
if (!chunk || !chunk.length)
if (!chunk || !state.objectMode && !chunk.length)
return;

var ret = self.push(chunk);
Expand Down
9 changes: 7 additions & 2 deletions lib/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,13 @@ function setupChannel(target, channel) {
var json = jsonBuffer.slice(start, i);
var message = JSON.parse(json);

handleMessage(target, message, recvHandle);
recvHandle = undefined;
// There will be at most one NODE_HANDLE message in every chunk we
// read because SCM_RIGHTS messages don't get coalesced. Make sure
// that we deliver the handle with the right message however.
if (message && message.cmd === 'NODE_HANDLE')
handleMessage(target, message, recvHandle);
else
handleMessage(target, message, undefined);

start = i + 1;
}
Expand Down
11 changes: 5 additions & 6 deletions test/pummel/test-net-many-clients.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,11 @@ for (var i = 0; i < bytes; i++) {
}

var server = net.createServer(function(c) {
c.on('connect', function() {
total_connections++;
common.print('#');
c.write(body);
c.end();
});
console.log('connected');
total_connections++;
common.print('#');
c.write(body);
c.end();
});

function runClient(callback) {
Expand Down
85 changes: 85 additions & 0 deletions test/simple/test-child-process-recv-handle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// Copyright Joyent, Inc. and other Node contributors.
//
// 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.

// Test that a Linux specific quirk in the handle passing protocol is handled
// correctly. See https://github.com/joyent/node/issues/5330 for details.

var common = require('../common');
var assert = require('assert');
var net = require('net');
var spawn = require('child_process').spawn;

if (process.argv[2] === 'worker')
worker();
else
master();

function master() {
// spawn() can only create one IPC channel so we use stdin/stdout as an
// ad-hoc command channel.
var proc = spawn(process.execPath, [__filename, 'worker'], {
stdio: ['pipe', 'pipe', 'pipe', 'ipc']
});
var handle = null;
proc.on('exit', function() {
handle.close();
});
proc.stdout.on('data', function(data) {
assert.equal(data, 'ok\r\n');
net.createServer(assert.fail).listen(common.PORT, function() {
handle = this._handle;
proc.send('one');
proc.send('two', handle);
proc.send('three');
proc.stdin.write('ok\r\n');
});
});
proc.stderr.pipe(process.stderr);
}

function worker() {
process._channel.readStop(); // Make messages batch up.
process.stdout.ref();
process.stdout.write('ok\r\n');
process.stdin.once('data', function(data) {
assert.equal(data, 'ok\r\n');
process._channel.readStart();
});
var n = 0;
process.on('message', function(msg, handle) {
n += 1;
if (n === 1) {
assert.equal(msg, 'one');
assert.equal(handle, undefined);
}
else if (n === 2) {
assert.equal(msg, 'two');
assert.equal(typeof handle, 'object'); // Also matches null, therefore...
assert.ok(handle); // also check that it's truthy.
handle.close();
}
else if (n === 3) {
assert.equal(msg, 'three');
assert.equal(handle, undefined);
process.exit();
}
});
}
43 changes: 43 additions & 0 deletions test/simple/test-stream2-readable-wrap-empty.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright Joyent, Inc. and other Node contributors.
//
// 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.

var common = require('../common');
var assert = require('assert');

var Readable = require('_stream_readable');
var EE = require('events').EventEmitter;

var oldStream = new EE();
oldStream.pause = function(){};
oldStream.resume = function(){};

var newStream = new Readable().wrap(oldStream);

var ended = false;
newStream
.on('readable', function(){})
.on('end', function(){ ended = true; });

oldStream.emit('end');

process.on('exit', function(){
assert.ok(ended);
});
Loading

0 comments on commit bdc5881

Please sign in to comment.