File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed
Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -205,10 +205,29 @@ extension CommandRegistry {
205205
206206 func launchTask( _ path: String , arguments: [ String ] ) -> Int32 {
207207 let task = Process ( )
208- task. launchPath = path
209208 task. arguments = arguments
210209
211- task. launch ( )
210+ do {
211+ #if canImport(Darwin)
212+ if #available( macOS 10 . 13 , * ) {
213+ task. executableURL = URL ( fileURLWithPath: path)
214+ try task. run ( )
215+ } else {
216+ task. launchPath = path
217+ task. launch ( )
218+ }
219+ #elseif compiler(>=5)
220+ task. executableURL = URL ( fileURLWithPath: path)
221+ try task. run ( )
222+ #else
223+ task. launchPath = path
224+ task. launch ( )
225+ #endif
226+ } catch let nserror as NSError {
227+ return Int32 ( truncatingIfNeeded: nserror. code)
228+ } catch {
229+ return - 1
230+ }
212231 task. waitUntilExit ( )
213232
214233 return task. terminationStatus
You can’t perform that action at this time.
0 commit comments