From fc33e6022b1d68a8d72f27ea6e6f4789ca4f491a Mon Sep 17 00:00:00 2001 From: Brian Hartvigsen Date: Wed, 20 Jan 2016 11:13:39 -0700 Subject: [PATCH] Catch exceptions when NSTask fails --- App/BitBar/Plugin.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/App/BitBar/Plugin.m b/App/BitBar/Plugin.m index e337ad502..c2d706c8e 100644 --- a/App/BitBar/Plugin.m +++ b/App/BitBar/Plugin.m @@ -160,7 +160,11 @@ - (void) startTask:(NSMutableDictionary*)params { [self performSelectorOnMainThread:@selector(performRefreshNow:) withObject:NULL waitUntilDone:false]; } }; - [(NSTask*)task launch]; + @try { + [(NSTask*)task launch]; + } @catch (NSException *e) { + NSLog(@"Error launching command for %@:\n\tCMD: %@\n\tARGS: %@\n%@", self.name, params[@"bash"], params[@"args"], e); + } [(NSTask*)task waitUntilExit]; }