summaryrefslogtreecommitdiff
path: root/src/node/utils/Abiword.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/node/utils/Abiword.js')
-rw-r--r--src/node/utils/Abiword.js18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/node/utils/Abiword.js b/src/node/utils/Abiword.js
index 27138e64..5f12bd97 100644
--- a/src/node/utils/Abiword.js
+++ b/src/node/utils/Abiword.js
@@ -63,7 +63,7 @@ if(os.type().indexOf("Windows") > -1)
callback();
});
- }
+ };
exports.convertFile = function(srcFile, destFile, type, callback)
{
@@ -100,7 +100,7 @@ else
{
//add data to buffer
stdoutBuffer+=data.toString();
-
+
//we're searching for the prompt, cause this means everything we need is in the buffer
if(stdoutBuffer.search("AbiWord:>") != -1)
{
@@ -121,27 +121,29 @@ else
firstPrompt = false;
}
});
- }
+ };
spawnAbiword();
doConvertTask = function(task, callback)
{
abiword.stdin.write("convert " + task.srcFile + " " + task.destFile + " " + task.type + "\n");
-
//create a callback that calls the task callback and the caller callback
stdoutCallback = function (err)
{
callback();
console.log("queue continue");
- task.callback(err);
+ try{
+ task.callback(err);
+ }catch(e){
+ console.error("Abiword File failed to convert", e);
+ }
};
- }
+ };
//Queue with the converts we have to do
var queue = async.queue(doConvertTask, 1);
-
exports.convertFile = function(srcFile, destFile, type, callback)
- {
+ {
queue.push({"srcFile": srcFile, "destFile": destFile, "type": type, "callback": callback});
};
}