我正在尝试使用Node.js解析XML Feed。到目前为止,我有代码只是为了获取块中的xml feed并将它们输出到控制台。出于某种原因,每当我运行它时,我会在随机点(每次运行时不同)得到“退出代码0”“向所有进程发送SIGKILL”消息。消息散布在xml的最后几行(示例输出结束):
01:17:55 web.1 | </item>
01:17:55 web.1 | exited with code 0
01:17:55 web.1 | <item>
01:17:55 system | sending SIGKILL to all processes
01:17:55 | <title>The Church of Scot
C:\CK3\dashboard>
有谁知道这可能导致提前退出的原因是什么?这是我的代码
var http = require('http');
//var xml2js = require('xml2js');
var options = {
host: 'feeds.bbci.co.uk',
port: 80,
path: '/news/rss.xml'
};
var req = http.get(options, function(res) {
//console.log('STATUS: ' + res.statusCode);
//console.log('HEADERS: ' + JSON.stringify(res.headers));
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log("\n\n new chunk \n\n");
console.log(chunk);
});
});
req.on('error', function(e) {
console.log('problem with request: ' + e.message);
});
req.end();
非常感谢你的时间和回应!
-Sixhobbits