Skip to content

Commit c0f1535

Browse files
addaleaxMylesBorins
authored andcommitted
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 PR-URL: #20388 Reviewed-By: Anatoli Papirovski <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
1 parent b2d6eb7 commit c0f1535

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

src/stream_base-inl.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,7 @@ void StreamBase::AddMethods(Environment* env,
335335

336336
env->SetProtoMethod(t, "readStart", JSMethod<Base, &StreamBase::ReadStartJS>);
337337
env->SetProtoMethod(t, "readStop", JSMethod<Base, &StreamBase::ReadStopJS>);
338-
if ((flags & kFlagNoShutdown) == 0)
339-
env->SetProtoMethod(t, "shutdown", JSMethod<Base, &StreamBase::Shutdown>);
338+
env->SetProtoMethod(t, "shutdown", JSMethod<Base, &StreamBase::Shutdown>);
340339
if ((flags & kFlagHasWritev) != 0)
341340
env->SetProtoMethod(t, "writev", JSMethod<Base, &StreamBase::Writev>);
342341
env->SetProtoMethod(t,

src/stream_base.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,7 @@ class StreamBase : public StreamResource {
257257
public:
258258
enum Flags {
259259
kFlagNone = 0x0,
260-
kFlagHasWritev = 0x1,
261-
kFlagNoShutdown = 0x2
260+
kFlagHasWritev = 0x1
262261
};
263262

264263
template <class Base>

src/tty_wrap.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void TTYWrap::Initialize(Local<Object> target,
6161
env->SetProtoMethod(t, "ref", HandleWrap::Ref);
6262
env->SetProtoMethod(t, "hasRef", HandleWrap::HasRef);
6363

64-
LibuvStreamWrap::AddMethods(env, t, StreamBase::kFlagNoShutdown);
64+
LibuvStreamWrap::AddMethods(env, t);
6565

6666
env->SetProtoMethod(t, "getWindowSize", TTYWrap::GetWindowSize);
6767
env->SetProtoMethod(t, "setRawMode", SetRawMode);

test/pseudo-tty/test-tty-stdin-end.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
require('../common');
3+
4+
// This test ensures that Node.js doesn't crash on `process.stdin.emit("end")`.
5+
// https://github.com/nodejs/node/issues/1068
6+
7+
process.stdin.emit('end');

test/pseudo-tty/test-tty-stdin-end.out

Whitespace-only changes.

0 commit comments

Comments
 (0)