pr_19296.patch 807 B

12345678910111213141516171819202122
  1. --- a/services/clsi/app/js/LatexRunner.js
  2. +++ b/services/clsi/app/js/LatexRunner.js
  3. @@ -110,11 +110,14 @@ function _writeLogOutput(projectId, directory, output, callback) {
  4. // internal method for writing non-empty log files
  5. function _writeFile(file, content, cb) {
  6. if (content && content.length > 0) {
  7. - fs.writeFile(file, content, err => {
  8. - if (err) {
  9. - logger.error({ err, projectId, file }, 'error writing log file') // don't fail on error
  10. - }
  11. - cb()
  12. + fs.unlink(file, () => {
  13. + fs.writeFile(file, content, { flag: 'wx' }, err => {
  14. + if (err) {
  15. + // don't fail on error
  16. + logger.error({ err, projectId, file }, 'error writing log file')
  17. + }
  18. + cb()
  19. + })
  20. })
  21. } else {
  22. cb()