mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
src: remove kFlagNoShutdown
flag
This was originally introduced in3446ff417b
, in order to fix a hard crash. However, since the libuv 1.18.0 update, that hard crash is gone, and sincef2b9805f85
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:
parent
4740e5dd8a
commit
5512fff623
@ -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,
|
||||
|
@ -257,8 +257,7 @@ class StreamBase : public StreamResource {
|
||||
public:
|
||||
enum Flags {
|
||||
kFlagNone = 0x0,
|
||||
kFlagHasWritev = 0x1,
|
||||
kFlagNoShutdown = 0x2
|
||||
kFlagHasWritev = 0x1
|
||||
};
|
||||
|
||||
template <class Base>
|
||||
|
@ -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);
|
||||
|
7
test/pseudo-tty/test-tty-stdin-end.js
Normal file
7
test/pseudo-tty/test-tty-stdin-end.js
Normal 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');
|
0
test/pseudo-tty/test-tty-stdin-end.out
Normal file
0
test/pseudo-tty/test-tty-stdin-end.out
Normal file
Loading…
Reference in New Issue
Block a user