Open elneruda opened 1 year ago
Any workarounds? Happens on osx 12 runners for me as well...
It happens for me from time to time. For example here: https://github.com/metgem/metgem_releases/actions/runs/6831611094/job/18581300522
[18/21] Unmounting temporary image... [FAIL]
[19/21] Removing temporary image... [ OK ]
[20/21] Removing target image... [ OK ]
Error: Command failed: hdiutil detach /Volumes/MetGem
hdiutil: detach failed - No such file or directory
Usage: file [-bcCdEhikLlNnprsSvzZ0] [--extension] [--mime-encoding]
[--mime-type] [-e <testname>] [-F <separator>] [-f <namefile>]
[-m <magicfiles>] [-M magicfiles] [-P <parameter=value>] [--exclude-quiet]
<file> ...
file -C [-m <magicfiles>]
file [--help]
Try `file --help' for more information.
I have encountered this issue as well, but it seems to occur randomly. Despite using the same code and packaging script, I have been unable to reproduce the problem consistently. After an extended period of use, it has only occurred once.
@LinusU looks like sometimes the volume is already unmounted and this attempts to unmount it, which throws an error. Here's the fix that worked for me (including patch file here): check if the volume exists before attempting to unmount:
In hdiutil.js:
exports.detach = function (path, cb) {
const args = ['detach', path];
let attempts = 0;
function attemptDetach(err) {
attempts += 1;
// Check if the path exists before attempting to detach
util.pathExists(path, (existsErr, exists) => {
if (existsErr || !exists) {
// the path doesn't exist, so we don't need to detach
cb(null);
return;
}
if (err && (err.exitCode === 16 || err.code === 16) && attempts <= 8) {
setTimeout(() => {
util.sh('hdiutil', args, attemptDetach);
}, 1000 * Math.pow(2, attempts - 1));
} else {
[appdmg+0.6.6.patch](https://github.com/LinusU/node-appdmg/files/14017142/appdmg%2B0.6.6.patch)
cb(err);
}
});
}
// Initial attempt to detach
util.sh('hdiutil', args, attemptDetach);
};
If the code above fixes the issue what is expected to fold it in? a PR? (@LinusU)
I'm currently encountering the same issue #142 running the following configuration:
runs-on: macos-13
This issue has also been reported on in the thread by me and Othyn: https://github.com/LinusU/node-appdmg/issues/142#issuecomment-1617089716 I haven't found a way to re-open issue so I'm opening this one.