MCPcopy
hub / github.com/corpnewt/gibMacOS / unmount_dmg

Method unmount_dmg

BuildmacOSInstallApp.py:44–62  ·  view source on GitHub ↗
(self, mount_point)

Source from the content-addressed store, hash-verified

42 raise Exception("Mount Failed!", "No mount points returned from {}".format(os.path.basename(dmg)))
43
44 def unmount_dmg(self, mount_point):
45 # Unmounts the passed dmg or mount point - retries with force if failed
46 # Can take either a single point or a list
47 if not type(mount_point) is list:
48 mount_point = [mount_point]
49 unmounted = []
50 for m in mount_point:
51 args = ["/usr/bin/hdiutil", "detach", m]
52 out = self.r.run({"args":args})
53 if out[2] != 0:
54 # Polite failed, let's crush this b!
55 args.append("-force")
56 out = self.r.run({"args":args})
57 if out[2] != 0:
58 # Oh... failed again... onto the next...
59 print(out[1])
60 continue
61 unmounted.append(m)
62 return unmounted
63
64 def main(self):
65 while True:

Callers 1

mainMethod · 0.95

Calls 1

runMethod · 0.80

Tested by

no test coverage detected