Merge pull request #8714 from overleaf/em-promisify-compile-manager

Promisify CompileManager

GitOrigin-RevId: 644ed061ae139d6196b24f8ead38579de6b844a3
This commit is contained in:
Eric Mc Sween
2022-07-07 08:27:20 -04:00
committed by Copybot
parent fceeef5b31
commit 77aa2baa9d
17 changed files with 973 additions and 992 deletions

View File

@@ -1,4 +1,5 @@
const Path = require('path')
const { promisify } = require('util')
const Settings = require('@overleaf/settings')
const logger = require('@overleaf/logger')
const CommandRunner = require('./CommandRunner')
@@ -192,4 +193,17 @@ function _buildLatexCommand(mainFile, opts = {}) {
module.exports = {
runLatex,
killLatex,
promises: {
runLatex: (projectId, options) =>
new Promise((resolve, reject) => {
runLatex(projectId, options, (err, output, stats, timing) => {
if (err) {
reject(err)
} else {
resolve({ output, stats, timing })
}
})
}),
killLatex: promisify(killLatex),
},
}