mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-11 13:16:45 -05:00
23 lines
807 B
Diff
23 lines
807 B
Diff
|
--- a/services/clsi/app/js/LatexRunner.js
|
||
|
+++ b/services/clsi/app/js/LatexRunner.js
|
||
|
@@ -110,11 +110,14 @@ function _writeLogOutput(projectId, directory, output, callback) {
|
||
|
// internal method for writing non-empty log files
|
||
|
function _writeFile(file, content, cb) {
|
||
|
if (content && content.length > 0) {
|
||
|
- fs.writeFile(file, content, err => {
|
||
|
- if (err) {
|
||
|
- logger.error({ err, projectId, file }, 'error writing log file') // don't fail on error
|
||
|
- }
|
||
|
- cb()
|
||
|
+ fs.unlink(file, () => {
|
||
|
+ fs.writeFile(file, content, { flag: 'wx' }, err => {
|
||
|
+ if (err) {
|
||
|
+ // don't fail on error
|
||
|
+ logger.error({ err, projectId, file }, 'error writing log file')
|
||
|
+ }
|
||
|
+ cb()
|
||
|
+ })
|
||
|
})
|
||
|
} else {
|
||
|
cb()
|