CPack fails to detach volume on Macos.
During creation of installation dmg it may fail to detach the dmg file. This happends randomly, but on some systems with up to 90% probabilty. Output:
CPack: Create package using DragNDrop CPack: Install projects CPack: - Install project: TEST CPack: Create package CPack Error: Error executing: /usr/bin/hdiutil detach "/Volumes/Test" CPack Error: Error detaching temporary disk image. CPack Error: Problem compressing the directory CPack Error: Error when generating package: Test make: *** [package_buildpart_0] Error 1
Buy running Instrumentation during the build process it was detected that it will fail to detach if
iconserviceagent accesses the drive at the last second (none of the successful runs contained
iconserviceagent and all failed did contain). My hypothesis is that after the icon is set, the
iconserviceagent swoops in to cache the icon at the same time as CPack tries to detach the volume.
It seems that the multiple tries of detach should be tried before giving up.