rmDir.js 535 B

1234567891011121314151617181920212223242526
  1. var fs = require("fs-extra");
  2. var rmDir = function(dirPath) {
  3. fs.removeSync(dirPath);
  4. }
  5. module.exports = function(dirPath) {
  6. // Retry cause sometimes locked on my mac :-)
  7. try {
  8. rmDir(dirPath);
  9. }
  10. catch (e) {
  11. try {
  12. rmDir(dirPath);
  13. }
  14. catch (e) {
  15. try {
  16. rmDir(dirPath);
  17. }
  18. catch (e) {
  19. // Something is definitely wrong here.
  20. throw e;
  21. }
  22. }
  23. }
  24. };