internal/child_process: call postSend on error
authorFedor Indutny <fedor@indutny.com>
Tue, 19 Jan 2016 01:59:18 +0000 (20:59 -0500)
committerMyles Borins <mborins@us.ibm.com>
Wed, 2 Mar 2016 22:01:11 +0000 (14:01 -0800)
commitd6894f8ea3da1d2d8222997403f88b743c42807b
tree0bbd9b3fce84f019e3d840620528e91a76006050
parentebb9f0dc11cf120dc479da012a81dd11299984ea
internal/child_process: call postSend on error

Call `obj.postSend` in error case of `process.send()`. The
`net.Socket`'s handle should not be leaked.

Note that there are two callbacks invoked on handles
when they are sent to the child process over IPC pipes.
These callbacks are specified by `handleConversion` object, and
during send two of them are invoked:

  * `send`
  * `postSend`

Now for `net.Socket` in particular, `postSend` performs clean up by
closing the actual uv handle. However this clean up will not happen in
one of the branches. This pull request aims to fix this.

PR-URL: https://github.com/nodejs/node/pull/4752
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
lib/internal/child_process.js