Node.js/process:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
Kangkk​(留言 | 贡献)
 
第5行: 第5行:
if (process.stdin.isTTY) {
if (process.stdin.isTTY) {
   process.stdin.setRawMode(true);
   process.stdin.setRawMode(true);
}</syntaxhighlight><br>
}</syntaxhighlight>
检测 process.stdout.isTTY<br>
: 检测 process.stdout.isTTY
{{Shc_out|<syntaxhighlight lang="bash">
: {{Shc_out|<syntaxhighlight lang="bash">
node -p -e "Boolean(process.stdout.isTTY)"</syntaxhighlight>|<syntaxhighlight lang="bash">true
node -p -e "Boolean(process.stdout.isTTY)"</syntaxhighlight>|<syntaxhighlight lang="bash">true
</syntaxhighlight>|$|/home/kangkk}}
</syntaxhighlight>|$|/home/kangkk}}

2021年7月15日 (四) 03:36的最新版本

标题文字

error

  • TypeError: process.stdin.setRawMode is not a function
if (process.stdin.isTTY) {
  process.stdin.setRawMode(true);
}
检测 process.stdout.isTTY
[jian@kang /home/kangkk]$
node -p -e "Boolean(process.stdout.isTTY)"
true