mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +01:00
Abiword: Use the async-provided callback to signal errors
This avoids having two callbacks, which improves readability.
This commit is contained in:
parent
8d32463915
commit
5eab3a123d
1 changed files with 4 additions and 6 deletions
|
@ -77,17 +77,15 @@ if (os.type().indexOf('Windows') > -1) {
|
||||||
};
|
};
|
||||||
spawnAbiword();
|
spawnAbiword();
|
||||||
|
|
||||||
doConvertTask = (task, callback) => {
|
const queue = async.queue((task, callback) => {
|
||||||
abiword.stdin.write(`convert ${task.srcFile} ${task.destFile} ${task.type}\n`);
|
abiword.stdin.write(`convert ${task.srcFile} ${task.destFile} ${task.type}\n`);
|
||||||
stdoutCallback = (err) => {
|
stdoutCallback = (err) => {
|
||||||
callback();
|
|
||||||
if (err != null) console.error('Abiword File failed to convert', err);
|
if (err != null) console.error('Abiword File failed to convert', err);
|
||||||
task.callback(err);
|
callback(err);
|
||||||
};
|
};
|
||||||
};
|
}, 1);
|
||||||
|
|
||||||
const queue = async.queue(doConvertTask, 1);
|
|
||||||
exports.convertFile = (srcFile, destFile, type, callback) => {
|
exports.convertFile = (srcFile, destFile, type, callback) => {
|
||||||
queue.push({srcFile, destFile, type, callback});
|
queue.push({srcFile, destFile, type}, callback);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue