Merge pull request #1743 from ether/dont-crash-on-export-abiword
catch error on exportpull/1745/merge
commit
c19b7b8f55
|
@ -127,19 +127,21 @@ else
|
||||||
doConvertTask = function(task, callback)
|
doConvertTask = function(task, callback)
|
||||||
{
|
{
|
||||||
abiword.stdin.write("convert " + task.srcFile + " " + task.destFile + " " + task.type + "\n");
|
abiword.stdin.write("convert " + task.srcFile + " " + task.destFile + " " + task.type + "\n");
|
||||||
|
|
||||||
//create a callback that calls the task callback and the caller callback
|
//create a callback that calls the task callback and the caller callback
|
||||||
stdoutCallback = function (err)
|
stdoutCallback = function (err)
|
||||||
{
|
{
|
||||||
callback();
|
callback();
|
||||||
console.log("queue continue");
|
console.log("queue continue");
|
||||||
|
try{
|
||||||
task.callback(err);
|
task.callback(err);
|
||||||
|
}catch(e){
|
||||||
|
console.error("Abiword File failed to convert", e);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
//Queue with the converts we have to do
|
//Queue with the converts we have to do
|
||||||
var queue = async.queue(doConvertTask, 1);
|
var queue = async.queue(doConvertTask, 1);
|
||||||
|
|
||||||
exports.convertFile = function(srcFile, destFile, type, callback)
|
exports.convertFile = function(srcFile, destFile, type, callback)
|
||||||
{
|
{
|
||||||
queue.push({"srcFile": srcFile, "destFile": destFile, "type": type, "callback": callback});
|
queue.push({"srcFile": srcFile, "destFile": destFile, "type": type, "callback": callback});
|
||||||
|
|
Loading…
Reference in New Issue