Showing with 121 additions and 128 deletions.
  1. +2 −5 doc/api/child_process.markdown
  2. +8 −0 src/node.cc
  3. +10 −1 test/debugger/test-debugger-repl.js
  4. +0 −122 test/simple/test-http-destroyed-socket-write.js
  5. +100 −0 test/simple/test-http-destroyed-socket-write2.js
  6. +1 −0 tools/install.py
@@ -378,11 +378,8 @@ Example of checking for failed exec:
var spawn = require('child_process').spawn,
child = spawn('bad_command');

child.stderr.setEncoding('utf8');
child.stderr.on('data', function (data) {
if (/^execvp\(\)/.test(data)) {
console.log('Failed to start child process.');
}
child.on('error', function (err) {
console.log('Failed to start child process.');
});

Note that if spawn receives an empty options object, it will result in
@@ -3093,6 +3093,9 @@ static void EnableDebug(Isolate* isolate, bool wait_connect) {
if (env == NULL)
return; // Still starting up.

// Assign environment to the debugger's context
env->AssignToContext(v8::Debug::GetDebugContext());

Context::Scope context_scope(env->context());
Local<Object> message = Object::New(env->isolate());
message->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "cmd"),
@@ -3594,6 +3597,11 @@ int Start(int argc, char** argv) {
Locker locker(node_isolate);
Environment* env =
CreateEnvironment(node_isolate, argc, argv, exec_argc, exec_argv);
// Assign env to the debugger's context
if (debugger_running) {
HandleScope scope(env->isolate());
env->AssignToContext(v8::Debug::GetDebugContext());
}
// This Context::Scope is here so EnableDebug() can look up the current
// environment with Environment::GetCurrentChecked().
// TODO(bnoordhuis) Reorder the debugger initialization logic so it can
@@ -74,4 +74,13 @@ addTest('c', [
/\d/, /\d/, /\d/, /\d/, /\d/
]);

addTest('quit', []);
// REPL and process.env regression
addTest('repl', [
/Ctrl/
]);

addTest('for (var i in process.env) delete process.env[i]', []);

addTest('process.env', [
/\{\}/
]);

This file was deleted.

@@ -0,0 +1,100 @@
// 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');

// Verify that ECONNRESET is raised when writing to a http request
// where the server has ended the socket.

var http = require('http');
var net = require('net');
var server = http.createServer(function(req, res) {
setImmediate(function() {
res.destroy();
});
});

server.listen(common.PORT, function() {
var req = http.request({
port: common.PORT,
path: '/',
method: 'POST'
});

var timer = setImmediate(write);
var writes = 0;

function write() {
if (++writes === 128) {
clearTimeout(timer);
req.end();
test();
} else {
timer = setImmediate(write);
req.write('hello');
}
}

var gotError = false;
var sawData = false;
var sawEnd = false;

req.on('error', function(er) {
assert(!gotError);
gotError = true;
assert(er.code === 'ECONNRESET', 'Expected ECONNRESET, got ' + er.code + ' ' + er.syscall);
clearTimeout(timer);
console.log('ECONNRESET was raised after %d writes', writes);
test();
});

req.on('response', function(res) {
res.on('data', function(chunk) {
console.error('saw data: ' + chunk);
sawData = true;
});
res.on('end', function() {
console.error('saw end');
sawEnd = true;
});
});

var closed = false;

function test() {
if (closed)
return;

server.close();
closed = true;

if (req.output.length || req.outputEncodings.length)
console.error('bad happened', req.output, req.outputEncodings);

assert.equal(req.output.length, 0);
assert.equal(req.outputEncodings, 0);
assert(gotError);
assert(!sawData);
assert(!sawEnd);
console.log('ok');
}
});
@@ -150,6 +150,7 @@ def files(action):
'src/node_internals.h',
'src/node_object_wrap.h',
'src/node_version.h',
'src/smalloc.h',
], 'include/node/')

if 'false' == variables.get('node_shared_cares'):