如何区分何时使用xargs

时间:2016-10-01 19:52:44

标签: javascript node.js

Node.js中是否有办法区分使用xargs调用的脚本和使用管道调用的脚本?

$ echo test | xargs node test.js
$ echo test | node test.js

我希望得到与process.stdin.isTTY described in the docs

类似的内容

1 个答案:

答案 0 :(得分:0)

您应该能够使用here描述的解决方案来检测某些数据是否正在通过管道传输到节点进程。

在xargs的情况下,流被传递给xargs而不是节点,因此尝试从stdin读取应该为null。