Skip to content

Commit

Permalink
tty: do not add shutdown method to handle
Browse files Browse the repository at this point in the history
UV_TTY does not support `uv_shutdown()` so adding this method in
StreamBase will cause an `abort()` in C land.

Fix: #1068
PR-URL: #1073
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
indutny committed Mar 5, 2015
1 parent 9d2b89d commit 3446ff4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/stream_base-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion src/stream_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ class StreamBase : public StreamResource {
public:
enum Flags {
kFlagNone = 0x0,
kFlagHasWritev = 0x1
kFlagHasWritev = 0x1,
kFlagNoShutdown = 0x2
};

template <class Base>
Expand Down
2 changes: 1 addition & 1 deletion src/tty_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions test/parallel/test-regress-GH-io-1068.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
process.stdin.emit('end');

0 comments on commit 3446ff4

Please sign in to comment.