summaryrefslogtreecommitdiff
path: root/src/tty_wrap.cc
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2019-04-18 10:46:39 +0800
committerJoyee Cheung <joyeec9h3@gmail.com>2019-04-20 13:25:41 +0800
commit8d901bb44e52077c4778261764892c959a94a6f2 (patch)
treedc3e97af8f314716f3ffb6f848ccfd2536d2de64 /src/tty_wrap.cc
parentb581d596558b8ebf2906fbf0d5a9ece2b07fa8d7 (diff)
downloadandroid-node-v8-8d901bb44e52077c4778261764892c959a94a6f2.tar.gz
android-node-v8-8d901bb44e52077c4778261764892c959a94a6f2.tar.bz2
android-node-v8-8d901bb44e52077c4778261764892c959a94a6f2.zip
src: move guessHandleType in the util binding
It does not make too much sense to have modules unrelated to TTY load the TTY binding just to use this method. Put this in the util binding instead. PR-URL: https://github.com/nodejs/node/pull/27289 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'src/tty_wrap.cc')
-rw-r--r--src/tty_wrap.cc25
1 files changed, 0 insertions, 25 deletions
diff --git a/src/tty_wrap.cc b/src/tty_wrap.cc
index 557f95f26f..7dface926e 100644
--- a/src/tty_wrap.cc
+++ b/src/tty_wrap.cc
@@ -59,7 +59,6 @@ void TTYWrap::Initialize(Local<Object> target,
env->SetProtoMethod(t, "setRawMode", SetRawMode);
env->SetMethodNoSideEffect(target, "isTTY", IsTTY);
- env->SetMethodNoSideEffect(target, "guessHandleType", GuessHandleType);
Local<Value> func;
if (t->GetFunction(env->context()).ToLocal(&func) &&
@@ -69,30 +68,6 @@ void TTYWrap::Initialize(Local<Object> target,
}
-void TTYWrap::GuessHandleType(const FunctionCallbackInfo<Value>& args) {
- Environment* env = Environment::GetCurrent(args);
- int fd;
- if (!args[0]->Int32Value(env->context()).To(&fd)) return;
- CHECK_GE(fd, 0);
-
- uv_handle_type t = uv_guess_handle(fd);
- const char* type = nullptr;
-
- switch (t) {
- case UV_TCP: type = "TCP"; break;
- case UV_TTY: type = "TTY"; break;
- case UV_UDP: type = "UDP"; break;
- case UV_FILE: type = "FILE"; break;
- case UV_NAMED_PIPE: type = "PIPE"; break;
- case UV_UNKNOWN_HANDLE: type = "UNKNOWN"; break;
- default:
- ABORT();
- }
-
- args.GetReturnValue().Set(OneByteString(env->isolate(), type));
-}
-
-
void TTYWrap::IsTTY(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
int fd;