【问题标题】:Why can't I spawn a simple command with node.js?为什么我不能用 node.js 生成一个简单的命令?
【发布时间】:2011-09-21 19:29:02
【问题描述】:
pipe(): Too many open files

node.js:134
        throw e; // process.nextTick error, or 'error' event on first tick
        ^
Error: Error spawning

那是我的错误。我的代码是:

grep  = spawn 'ls' 

更新

用于 indexedTweetsResults 中的推文 执行'ls',(错误,标准输出,标准错误)-> console.log 标准输出

这是我的代码,它出现pipe 错误。有什么想法吗?

【问题讨论】:

标签: command-line node.js


【解决方案1】:

你需要做的

exec = require("child_process").exec

然后在某处做

exec("ls", function(error, stdout, stderr) {
   // handle error, stdout, stderr
});

你必须写 javascript....

【讨论】:

  • 奇怪 - 我在一个称为 2 个函数的函数中有这个,它返回错误。如果它是文件中唯一的东西,那么它工作正常
猜你喜欢
  • 2019-03-25
  • 1970-01-01
  • 2016-09-17
  • 2017-01-02
  • 2015-12-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多