Use old API to launch tasks on all versions of macOS

This commit is contained in:
Matt Hardcastle 2019-06-24 14:27:07 -07:00
parent 4f6e2c85f9
commit 9ae67c15b2

View file

@ -23,24 +23,14 @@
NSLog(@"calling interface at %@", self->pathTo); NSLog(@"calling interface at %@", self->pathTo);
if (@available(macOS 10.13, *)) { NSError *error = nil;
NSError *error = nil; [interface launch];
if (![interface launchAndReturnError:&error]) { [interface waitUntilExit];
*outError = [NSError errorWithDomain:@"interface" if (0 != [interface terminationStatus]) {
code:-1 *outError = [NSError errorWithDomain:@"interface"
userInfo:@{NSUnderlyingErrorKey: error}]; code:-1
return 0; userInfo:@{NSUnderlyingErrorKey: error}];
} return 0;
} else {
NSError *error = nil;
[interface launch];
[interface waitUntilExit];
if (0 != [interface terminationStatus]) {
*outError = [NSError errorWithDomain:@"interface"
code:-1
userInfo:@{NSUnderlyingErrorKey: error}];
return 0;
}
} }
NSFileHandle * fh = [standardOut fileHandleForReading]; NSFileHandle * fh = [standardOut fileHandleForReading];