【问题标题】:stdwin is not a tty (mingw64)stdwin 不是 tty (mingw64)
【发布时间】:2021-07-08 19:53:39
【问题描述】:

我正在尝试在 Windows10 机器上使用 Node 学习 STDIN/STDOUT 的基础知识。

这是我的 JS 文件(test.js):

process.stdin.resume();
process.stdin.setEncoding('utf8');

process.stdin.on('data', function (chunk) {
    process.stdout.write('chunk:' + chunk.toString());
});

process.stdin.on('end', function () {
    process.stdout.write('end')
});

这是我的文本文件 (test.txt)

hello
world
again

这是我在 MINGW64 中运行的命令和结果

$ cat test.txt | node test.js
stdin is not a tty

我是 Bash 和 STDIN/STDOUT 的新手,所以请保持温和。 :)

【问题讨论】:

    标签: javascript bash stdin


    【解决方案1】:

    仍然不知道为什么 GitBash 不起作用,但我发现您可以使用 PowerShell 完成相同的工作。

    【讨论】:

      猜你喜欢
      • 2017-04-02
      • 2016-02-10
      • 2017-05-31
      • 2014-11-27
      • 2020-10-28
      • 2017-08-23
      • 2021-04-06
      • 1970-01-01
      相关资源
      最近更新 更多