def DetachDiskImage(path):
  """forcibly unmounts a given dmg from the mountpoint path."""

  command = ["/usr/bin/hdiutil", "detach", path]
  returncode = subprocess.call(command)
  if returncode:
    command = ["/usr/bin/hdiutil", "detach", "-force", path]
    returncode = subprocess.call(command)
    if returncode:
      raise StandardError("Unable to unmount dmg mounted at: %s" % path)
  return True
dataset/ETHPy150Open MacSysadmin/pymacadmin/utilities/diskimage_unittesting/run_image_tests.py/DetachDiskImage/original