Node.js 节点繁殖标准值未定义
我有以下代码:Node.js 节点繁殖标准值未定义,node.js,child-process,spawn,Node.js,Child Process,Spawn,我有以下代码: Printer.prototype.watch = function() { var self = this; var args = ["-P", this.name]; var lpq = spawn('lpq', args); lpq.stdout.on("data", function(data) { (some irrelevant code) }); lpq.on("exit", function() { self
Printer.prototype.watch = function() {
var self = this; var args = ["-P", this.name];
var lpq = spawn('lpq', args);
lpq.stdout.on("data", function(data) {
(some irrelevant code)
});
lpq.on("exit", function() {
self.watch();
});
};
在一些递归调用之后,
spawn('lpq',args)
返回一个带有stdout=undefined
的对象。为什么会发生这种情况?请尝试stderr,以便查看错误消息
lpq.stderr.on("data", function(data) {
console.log("stderr------",data.toString());
});
stderr对我来说也是未定义的