diff --git a/Sources/NSTask+AnyPromise.m b/Sources/NSTask+AnyPromise.m index bfabd61..646e933 100644 --- a/Sources/NSTask+AnyPromise.m +++ b/Sources/NSTask+AnyPromise.m @@ -37,7 +37,16 @@ - (AnyPromise *)promise { resolve([NSError errorWithDomain:PMKErrorDomain code:PMKTaskError userInfo:info]); } }; - [self launch]; + + if (@available(macOS 10.13, *)) { + NSError *error = nil; + + if (![self launchAndReturnError:&error]) { + resolve(error); + } + } else { + [self launch]; + } }]; }