Skip to content

Commit

Permalink
fix(processor): add race condition warning
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW committed Oct 2, 2021
1 parent e4e15b8 commit b411032
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/plugins/processor/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const { parse: yfm } = require('hexo-front-matter');
const { extname, join } = require('path');
const { stat, listDir } = require('hexo-fs');
const { slugize, Pattern, Permalink } = require('hexo-util');
const { magenta } = require('nanocolors');

const postDir = '_posts/';
const draftDir = '_drafts/';
Expand Down Expand Up @@ -164,6 +165,9 @@ function processPost(ctx, file) {
}

if (doc) {
if (file.type !== 'update') {
ctx.log.warn(`Trying to "create" ${magenta(file.path)}, but the file already exists!`);
}
return doc.replace(data);
}

Expand Down

0 comments on commit b411032

Please sign in to comment.