Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: remove kFlagNoShutdown flag #20388

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
src: remove kFlagNoShutdown flag
This was originally introduced in 3446ff4, in order to fix
a hard crash. However, since the libuv 1.18.0 update, that hard
crash is gone, and since f2b9805 we do not throw an
error in JS land anymore either, rendering the flag unnecessary.

Also, the original test that checked this condition was added
to `test/parallel/`. Since that typically runs without a TTY stdin,
a duplicate test is being added to the pseudo-tty test suite
in this commit.

Refs: 3446ff4
Refs: f2b9805
Refs: libuv/libuv@0e28141
  • Loading branch information
addaleax committed Apr 28, 2018
commit 90f2f07481985f91bc5924c51d195c42c536394e
3 changes: 1 addition & 2 deletions src/stream_base-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,7 @@ void StreamBase::AddMethods(Environment* env,

env->SetProtoMethod(t, "readStart", JSMethod<Base, &StreamBase::ReadStartJS>);
env->SetProtoMethod(t, "readStop", JSMethod<Base, &StreamBase::ReadStopJS>);
if ((flags & kFlagNoShutdown) == 0)
env->SetProtoMethod(t, "shutdown", JSMethod<Base, &StreamBase::Shutdown>);
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: 1 addition & 2 deletions src/stream_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,7 @@ class StreamBase : public StreamResource {
public:
enum Flags {
kFlagNone = 0x0,
kFlagHasWritev = 0x1,
kFlagNoShutdown = 0x2
kFlagHasWritev = 0x1
};

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 @@ -61,7 +61,7 @@ void TTYWrap::Initialize(Local<Object> 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);
Expand Down
7 changes: 7 additions & 0 deletions test/pseudo-tty/test-tty-stdin-end.js
Original file line number Diff line number Diff line change
@@ -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');
1 change: 1 addition & 0 deletions test/pseudo-tty/test-tty-stdin-end.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@