Permalink
Browse files

Use fs.lstat in node >= 0.7.9

  • Loading branch information...
1 parent bffb4e6 commit 1c396610928055d3cdaf46fd8aef4ae932b93b58 @isaacs committed Jun 8, 2012
Showing with 10 additions and 2 deletions.
  1. +10 −2 rimraf.js
View
@@ -11,8 +11,16 @@ try {
fs = require("fs")
}
-var lstat = process.platform === "win32" ? "stat" : "lstat"
- , lstatSync = lstat + "Sync"
+var lstat = "lstat"
+if (process.platform === "win32") {
+ // not reliable on windows prior to 0.7.9
+ var v = process.version.replace(/^v/, '').split(/\.|-/).map(Number)
+ if (v[0] === 0 && (v[1] < 7 || v[1] == 7 && v[2] < 9)) {
+ lstat = "stat"
+ }
+}
+if (!fs[lstat]) lstat = "stat"
+var lstatSync = lstat + "Sync"
// for EMFILE handling
var timeout = 0

0 comments on commit 1c39661

Please sign in to comment.