diff options
author | Jeremiah Senkpiel <fishrock123@rocketmail.com> | 2016-04-14 18:55:34 -0400 |
---|---|---|
committer | Jeremiah Senkpiel <fishrock123@rocketmail.com> | 2016-04-25 18:17:40 -0400 |
commit | 9bb5a5e2a127010807f5b8a8bf4cf34109271c55 (patch) | |
tree | 568dd135433a45fe4d4b8ee9ea60502c79a889c3 /test/parallel/test-handle-wrap-isrefed-tty.js | |
parent | eb4201f07a1b1f430ddf4efad4f276f3088def97 (diff) | |
download | android-node-v8-9bb5a5e2a127010807f5b8a8bf4cf34109271c55.tar.gz android-node-v8-9bb5a5e2a127010807f5b8a8bf4cf34109271c55.tar.bz2 android-node-v8-9bb5a5e2a127010807f5b8a8bf4cf34109271c55.zip |
handle_wrap: IsRefed -> Unrefed, no isAlive check
This fixes my perceived usability issues with 7d8882b. Which, at the
time of writing, has not landed in any release except v6 RCs. This
should not be considered a breaking change due to that.
It is useful if you have a handle, even if it has been closed, to be
able to inspect whether that handle was unrefed or not. As such, this
renames the method accordingly. If people need to check a handle's
aliveness, that is a separate API we should consider exposing.
Refs: https://github.com/nodejs/node/pull/5834
PR-URL: https://github.com/nodejs/node/pull/6204
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Diffstat (limited to 'test/parallel/test-handle-wrap-isrefed-tty.js')
-rw-r--r-- | test/parallel/test-handle-wrap-isrefed-tty.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/test/parallel/test-handle-wrap-isrefed-tty.js b/test/parallel/test-handle-wrap-isrefed-tty.js index 9656fe06ee..4c31d63b52 100644 --- a/test/parallel/test-handle-wrap-isrefed-tty.js +++ b/test/parallel/test-handle-wrap-isrefed-tty.js @@ -9,16 +9,18 @@ function makeAssert(message) { strictEqual(actual, expected, message); }; } -const assert = makeAssert('isRefed() not working on tty_wrap'); +const assert = makeAssert('unrefed() not working on tty_wrap'); if (process.argv[2] === 'child') { // Test tty_wrap in piped child to guarentee stdin being a TTY. const ReadStream = require('tty').ReadStream; const tty = new ReadStream(0); - assert(Object.getPrototypeOf(tty._handle).hasOwnProperty('isRefed'), true); - assert(tty._handle.isRefed(), true); + assert(Object.getPrototypeOf(tty._handle).hasOwnProperty('unrefed'), true); + assert(tty._handle.unrefed(), false); tty.unref(); - assert(tty._handle.isRefed(), false); + assert(tty._handle.unrefed(), true); + tty._handle.close(); + assert(tty._handle.unrefed(), true); return; } |