src: remove kFlagNoShutdown flag

This was originally introduced in 3446ff417b, in order to fix
a hard crash. However, since the libuv 1.18.0 update, that hard
crash is gone, and since f2b9805f85 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: 3446ff417b
Refs: f2b9805f85
Refs: 0e2814179c
PR-URL: https://github.com/nodejs/node/pull/20388
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
Anna Henningsen 2018-04-28 21:33:46 +02:00
parent 4740e5dd8a
commit 5512fff623
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9
5 changed files with 10 additions and 5 deletions

View File

@ -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,

View File

@ -257,8 +257,7 @@ class StreamBase : public StreamResource {
public:
enum Flags {
kFlagNone = 0x0,
kFlagHasWritev = 0x1,
kFlagNoShutdown = 0x2
kFlagHasWritev = 0x1
};
template <class Base>

View File

@ -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);

View File

@ -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');

View File