From ec0889ef83afdaf7292fe260decb27f1e5374c29 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 28 May 2016 17:06:41 -0400 Subject: [PATCH] Redirect stdout/stderr when unmounting dmg --- Sparkle/SUDiskImageUnarchiver.m | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Sparkle/SUDiskImageUnarchiver.m b/Sparkle/SUDiskImageUnarchiver.m index 46cdb3dd..e0cfdb44 100644 --- a/Sparkle/SUDiskImageUnarchiver.m +++ b/Sparkle/SUDiskImageUnarchiver.m @@ -170,10 +170,22 @@ dispatch_async(dispatch_get_main_queue(), delegateFailure); finally: - if (mountedSuccessfully) - [NSTask launchedTaskWithLaunchPath:@"/usr/bin/hdiutil" arguments:@[@"detach", mountPoint, @"-force"]]; - else + if (mountedSuccessfully) { + NSTask *task = [[NSTask alloc] init]; + task.launchPath = @"/usr/bin/hdiutil"; + task.arguments = @[@"detach", mountPoint, @"-force"]; + task.standardOutput = [NSPipe pipe]; + task.standardError = [NSPipe pipe]; + + @try { + [task launch]; + } @catch (NSException *exception) { + SULog(@"Failed to unmount %@", mountPoint); + SULog(@"Exception: %@", exception); + } + } else { SULog(@"Can't mount DMG %@", self.archivePath); + } } }