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

Clean up in Child_process module #2463

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lib/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function setupChannel(target, channel) {
var writeReq = channel.write(buffer, 0, buffer.length, sendHandle);

if (!writeReq) {
throw new Error(errno + 'cannot write to IPC channel.');
throw errnoException(errno, 'write', 'cannot write to IPC channel.');
}

writeReq.oncomplete = nop;
Expand Down Expand Up @@ -471,11 +471,15 @@ ChildProcess.prototype.spawn = function(options) {
};


function errnoException(errorno, syscall) {
function errnoException(errorno, syscall, errmsg) {
// TODO make this more compatible with ErrnoException from src/node.cc
// Once all of Node is using this function the ErrnoException from
// src/node.cc should be removed.
var e = new Error(syscall + ' ' + errorno);
var message = syscall + ' ' + errorno;
if (errmsg) {
message += ' - ' + errmsg;
}
var e = new Error(message);
e.errno = e.code = errorno;
e.syscall = syscall;
return e;
Expand Down