diff --git a/src/stream_base-inl.h b/src/stream_base-inl.h index 392dc2c87c3..4f4252073d2 100644 --- a/src/stream_base-inl.h +++ b/src/stream_base-inl.h @@ -335,8 +335,7 @@ void StreamBase::AddMethods(Environment* env, env->SetProtoMethod(t, "readStart", JSMethod); env->SetProtoMethod(t, "readStop", JSMethod); - if ((flags & kFlagNoShutdown) == 0) - env->SetProtoMethod(t, "shutdown", JSMethod); + env->SetProtoMethod(t, "shutdown", JSMethod); if ((flags & kFlagHasWritev) != 0) env->SetProtoMethod(t, "writev", JSMethod); env->SetProtoMethod(t, diff --git a/src/stream_base.h b/src/stream_base.h index 96b8589b068..94a091988cf 100644 --- a/src/stream_base.h +++ b/src/stream_base.h @@ -257,8 +257,7 @@ class StreamBase : public StreamResource { public: enum Flags { kFlagNone = 0x0, - kFlagHasWritev = 0x1, - kFlagNoShutdown = 0x2 + kFlagHasWritev = 0x1 }; template diff --git a/src/tty_wrap.cc b/src/tty_wrap.cc index 9977738afcb..c5abc6bf9b9 100644 --- a/src/tty_wrap.cc +++ b/src/tty_wrap.cc @@ -61,7 +61,7 @@ void TTYWrap::Initialize(Local target, env->SetProtoMethod(t, "ref", HandleWrap::Ref); env->SetProtoMethod(t, "hasRef", HandleWrap::HasRef); - LibuvStreamWrap::AddMethods(env, t, StreamBase::kFlagNoShutdown); + LibuvStreamWrap::AddMethods(env, t); env->SetProtoMethod(t, "getWindowSize", TTYWrap::GetWindowSize); env->SetProtoMethod(t, "setRawMode", SetRawMode); diff --git a/test/pseudo-tty/test-tty-stdin-end.js b/test/pseudo-tty/test-tty-stdin-end.js new file mode 100644 index 00000000000..c78f58446d0 --- /dev/null +++ b/test/pseudo-tty/test-tty-stdin-end.js @@ -0,0 +1,7 @@ +'use strict'; +require('../common'); + +// This test ensures that Node.js doesn't crash on `process.stdin.emit("end")`. +// https://github.com/nodejs/node/issues/1068 + +process.stdin.emit('end'); diff --git a/test/pseudo-tty/test-tty-stdin-end.out b/test/pseudo-tty/test-tty-stdin-end.out new file mode 100644 index 00000000000..e69de29bb2d