(path, options, callback)
| 56 | |
| 57 | |
| 58 | function _rimraf(path, options, callback) { |
| 59 | // SunOS lets the root user unlink directories. Use lstat here to make sure |
| 60 | // it's not a directory. |
| 61 | lstat(path, (err, stats) => { |
| 62 | if (err) { |
| 63 | if (err.code === 'ENOENT') |
| 64 | return callback(null); |
| 65 | |
| 66 | // Windows can EPERM on stat. |
| 67 | if (isWindows && err.code === 'EPERM') |
| 68 | return fixWinEPERM(path, options, err, callback); |
| 69 | } else if (stats.isDirectory()) { |
| 70 | return _rmdir(path, options, err, callback); |
| 71 | } |
| 72 | |
| 73 | unlink(path, (err) => { |
| 74 | if (err) { |
| 75 | if (err.code === 'ENOENT') |
| 76 | return callback(null); |
| 77 | if (err.code === 'EISDIR') |
| 78 | return _rmdir(path, options, err, callback); |
| 79 | if (err.code === 'EPERM') { |
| 80 | return epermHandler(path, options, err, callback); |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | return callback(err); |
| 85 | }); |
| 86 | }); |
| 87 | } |
| 88 | |
| 89 | |
| 90 | function fixWinEPERM(path, options, originalErr, callback) { |
no test coverage detected