I have this code:
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();
});
};
After some recursive calls, spawn('lpq', args) returns a object with stdout=undefined. Why is this happening?