diff --git a/src/stream_base-inl.h b/src/stream_base-inl.h
index 490909456b3624..46d9f78905f2eb 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);
env->SetProtoMethod(t, "readStop", JSMethod);
- env->SetProtoMethod(t, "shutdown", JSMethod);
+ if ((flags & kFlagNoShutdown) == 0)
+ 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 dcbde09bacf25d..5718f07ae14d29 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
diff --git a/src/tty_wrap.cc b/src/tty_wrap.cc
index 186f2f0100162e..eaec271937530e 100644
--- a/src/tty_wrap.cc
+++ b/src/tty_wrap.cc
@@ -39,7 +39,7 @@ void TTYWrap::Initialize(Handle