From bee3766f09bac22fdd8cc6636bbc48415f8c0fa4 Mon Sep 17 00:00:00 2001 From: Michael Starke Date: Thu, 24 Nov 2022 00:25:45 +0100 Subject: [PATCH] shortened relaunch NSTask invocation --- MacPass/NSApplication+MPAdditions.m | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/MacPass/NSApplication+MPAdditions.m b/MacPass/NSApplication+MPAdditions.m index 0970cbdf..ec7036c0 100644 --- a/MacPass/NSApplication+MPAdditions.m +++ b/MacPass/NSApplication+MPAdditions.m @@ -55,11 +55,9 @@ } - (void)relaunchAfterDelay:(CGFloat)seconds { - NSTask *task = [[NSTask alloc] init]; - task.launchPath = @"/bin/sh"; - task.arguments = @[ @"-c", [NSString stringWithFormat:@"sleep %f; open \"%@\"", seconds, NSBundle.mainBundle.bundlePath] ]; - [task launch]; - [self terminate:nil]; + NSArray *args = @[@"-c", [NSString stringWithFormat:@"sleep %f; open \"%@\"", seconds, NSBundle.mainBundle.bundlePath]]; + [NSTask launchedTaskWithLaunchPath:@"/bin/sh" arguments:args]; + [self terminate:self]; } - (MPAppDelegate *)mp_delegate {