Skip to content

Commit

Permalink
Merge pull request #124 from SparshithNR/existSync
Browse files Browse the repository at this point in the history
Fixing windows test with a temporary workaround
  • Loading branch information
stefanpenner committed Feb 20, 2020
2 parents 0492493 + a014a27 commit a6aa9dc
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const debug = require('debug');
const FSTree = require('fs-tree-diff');
const BlankObject = require('blank-object');
const heimdall = require('heimdalljs');
const fs = require('fs');

function ApplyPatchesSchema() {
this.mkdir = 0;
Expand Down Expand Up @@ -42,6 +43,19 @@ function isNotAPattern(pattern) {

return true;
}
function existsSync(path) {
let error = {};
try {
fs.accessSync(path);
fs.statSync(path);
} catch (err) {
error = err;
}
if (error.errno && error.errno !== 0) {
return false;
}
return true;
}

class Funnel extends Plugin {
constructor(inputNode, options = {}) {
Expand Down Expand Up @@ -208,6 +222,12 @@ class Funnel extends Plugin {

// This is specifically looking for broken symlinks.
let outputPathExists = this.output.existsSync('./');
// We need to keep this till node 10,12 get fix for windows broken symlink issue.
// https://github.com/nodejs/node/issues/30538
let isWin = process.platform === 'win32';
if (isWin) {
outputPathExists = existsSync(this.outputPath);
}

// Doesn't count as a rebuild if there's not an existing outputPath.
this._isRebuild = this._isRebuild && outputPathExists;
Expand Down

0 comments on commit a6aa9dc

Please sign in to comment.