We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e1394d2 commit c9689f6Copy full SHA for c9689f6
lib/hdiutil.js
@@ -63,13 +63,17 @@ exports.attach = function (path, cb) {
63
exports.detach = function (path, cb) {
64
const args = ['detach', path]
65
66
- util.sh('hdiutil', args, function (err) {
67
- if (err && err.exitCode === 16 && /Resource busy/.test(err.stderr)) {
+ let attempts = 0
+ function attemptDetach (err) {
68
+ attempts += 1
69
+ if (err && (err.exitCode === 16 || err.code === 16) && /Resource busy/.test(err.stderr) && attempts <= 5) {
70
setTimeout(function () {
- util.sh('hdiutil', args, (err) => cb(err))
- }, 1000)
71
+ util.sh('hdiutil', args, attemptDetach)
72
+ }, 1000 * Math.pow(2, attempts - 1))
73
} else {
74
cb(err)
75
}
- })
76
+ }
77
+
78
79
0 commit comments