summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFedor Indutny <fedor@indutny.com>2015-03-05 11:04:00 -0500
committerFedor Indutny <fedor@indutny.com>2015-03-05 13:38:22 -0500
commit3446ff417ba1e11d35d1661b8788eac5af029360 (patch)
tree9e48f3d4ddecc8a0e243406c6b826a10b7611626
parent9d2b89d06c14f8e250e290668507c9daa8ec97ca (diff)
downloadandroid-node-v8-3446ff417ba1e11d35d1661b8788eac5af029360.tar.gz
android-node-v8-3446ff417ba1e11d35d1661b8788eac5af029360.tar.bz2
android-node-v8-3446ff417ba1e11d35d1661b8788eac5af029360.zip
tty: do not add `shutdown` method to handle
UV_TTY does not support `uv_shutdown()` so adding this method in StreamBase will cause an `abort()` in C land. Fix: https://github.com/iojs/io.js/issues/1068 PR-URL: https://github.com/iojs/io.js/pull/1073 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
-rw-r--r--src/stream_base-inl.h3
-rw-r--r--src/stream_base.h3
-rw-r--r--src/tty_wrap.cc2
-rw-r--r--test/parallel/test-regress-GH-io-1068.js1
4 files changed, 6 insertions, 3 deletions
diff --git a/src/stream_base-inl.h b/src/stream_base-inl.h
index 490909456b..46d9f78905 100644
--- a/src/stream_base-inl.h
+++ b/src/stream_base-inl.h
@@ -37,7 +37,8 @@ void StreamBase::AddMethods(Environment* env,
env->SetProtoMethod(t, "readStart", JSMethod<Base, &StreamBase::ReadStart>);
env->SetProtoMethod(t, "readStop", JSMethod<Base, &StreamBase::ReadStop>);
- env->SetProtoMethod(t, "shutdown", JSMethod<Base, &StreamBase::Shutdown>);
+ if ((flags & kFlagNoShutdown) == 0)
+ env->SetProtoMethod(t, "shutdown", JSMethod<Base, &StreamBase::Shutdown>);
if ((flags & kFlagHasWritev) != 0)
env->SetProtoMethod(t, "writev", JSMethod<Base, &StreamBase::Writev>);
env->SetProtoMethod(t,
diff --git a/src/stream_base.h b/src/stream_base.h
index dcbde09bac..5718f07ae1 100644
--- a/src/stream_base.h
+++ b/src/stream_base.h
@@ -160,7 +160,8 @@ class StreamBase : public StreamResource {
public:
enum Flags {
kFlagNone = 0x0,
- kFlagHasWritev = 0x1
+ kFlagHasWritev = 0x1,
+ kFlagNoShutdown = 0x2
};
template <class Base>
diff --git a/src/tty_wrap.cc b/src/tty_wrap.cc
index 186f2f0100..eaec271937 100644
--- a/src/tty_wrap.cc
+++ b/src/tty_wrap.cc
@@ -39,7 +39,7 @@ void TTYWrap::Initialize(Handle<Object> target,
env->SetProtoMethod(t, "close", HandleWrap::Close);
env->SetProtoMethod(t, "unref", HandleWrap::Unref);
- StreamWrap::AddMethods(env, t);
+ StreamWrap::AddMethods(env, t, StreamBase::kFlagNoShutdown);
env->SetProtoMethod(t, "getWindowSize", TTYWrap::GetWindowSize);
env->SetProtoMethod(t, "setRawMode", SetRawMode);
diff --git a/test/parallel/test-regress-GH-io-1068.js b/test/parallel/test-regress-GH-io-1068.js
new file mode 100644
index 0000000000..e769e6b81a
--- /dev/null
+++ b/test/parallel/test-regress-GH-io-1068.js
@@ -0,0 +1 @@
+process.stdin.emit('end');