From c4b56e0462329211068488e6b74846d36d38ce63 Mon Sep 17 00:00:00 2001 From: dengxiang Date: Sat, 28 Aug 2021 08:52:42 +0800 Subject: [PATCH] Support Android platform Android platform have no '/dev/stdin', use '/proc/self/fd/0' for it. --- lib/gets.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/gets.js b/lib/gets.js index ecca6fa..12539a7 100644 --- a/lib/gets.js +++ b/lib/gets.js @@ -12,7 +12,9 @@ module.exports = function() { var fd = 'win32' === process.platform ? process.stdin.fd - : fs.openSync('/dev/stdin', 'rs'); + : 'android' === process.platform + ? fs.openSync('/proc/self/fd/0', 'rs') + : fs.openSync('/dev/stdin', 'rs'); bytesRead = 0; try {