Skip to content

Commit

Permalink
Fix rimraf bin resolution (#566)
Browse files Browse the repository at this point in the history
  • Loading branch information
rtsao authored and hzoo committed Feb 2, 2017
1 parent e3fc0e9 commit 15d52df
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/FileSystemUtilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import mkdirp from "mkdirp";
import fs from "fs";
import cmdShim from "cmd-shim";
import readCmdShim from "read-cmd-shim";
import { resolve, dirname, relative, join } from "path";
import { resolve, dirname, relative } from "path";
import ChildProcessUtilities from "./ChildProcessUtilities";

const ENDS_WITH_NEW_LINE = /\n$/;
Expand Down Expand Up @@ -51,10 +51,8 @@ export default class FileSystemUtilities {

@logger.logifyAsync()
static rimraf(filePath, callback) {
ChildProcessUtilities.exec("npm bin", {cwd: __dirname}, (err, npmBinPath) => {
if (err) return callback(err);
ChildProcessUtilities.spawn(join(npmBinPath.trim(), "rimraf"), [filePath], {}, callback);
});
// Note: if rimraf moves the location of its executable, this will need to be updated
ChildProcessUtilities.spawn(require.resolve("rimraf/bin"), [filePath], {}, callback);
}

@logger.logifyAsync()
Expand Down

0 comments on commit 15d52df

Please sign in to comment.