Node.js/process:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
创建页面,内容为“== 标题文字 == == error == * TypeError: process.stdin.setRawMode is not a function : <syntaxhighlight lang="javascript"> if (process.stdin.isTTY) { process.std…”
 
Kangkk​(留言 | 贡献)
 
(未显示同一用户的1个中间版本)
第6行: 第6行:
   process.stdin.setRawMode(true);
   process.stdin.setRawMode(true);
}</syntaxhighlight>
}</syntaxhighlight>
: 检测 process.stdout.isTTY
: {{Shc_out|<syntaxhighlight lang="bash">
node -p -e "Boolean(process.stdout.isTTY)"</syntaxhighlight>|<syntaxhighlight lang="bash">true
</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