@@ -519,9 +519,6 @@ public final class Process {
519519 public enum Error : Swift . Error , Sendable {
520520 /// The program requested to be executed cannot be found on the existing search paths, or is not executable.
521521 case missingExecutableProgram( program: String )
522-
523- /// The current OS does not support the workingDirectory API.
524- case workingDirectoryNotSupported
525522 }
526523
527524 public enum OutputRedirection {
@@ -977,22 +974,7 @@ public final class Process {
977974 defer { posix_spawn_file_actions_destroy ( & fileActions) }
978975
979976 if let workingDirectory = workingDirectory? . path {
980- #if canImport(Darwin) && !targetEnvironment(macCatalyst)
981- // The only way to set a workingDirectory is using an availability-gated initializer, so we don't need
982- // to handle the case where the posix_spawn_file_actions_addchdir_np method is unavailable. This check only
983- // exists here to make the compiler happy.
984- if #available( macOS 10 . 15 , * ) {
985- posix_spawn_file_actions_addchdir_np ( & fileActions, workingDirectory)
986- }
987- #elseif os(Linux)
988- //guard SPM_posix_spawn_file_actions_addchdir_np_supported() else {
989- //throw Process.Error.workingDirectoryNotSupported
990- //}
991-
992977 posix_spawn_file_actions_addchdir_np ( & fileActions, workingDirectory)
993- #else
994- throw Process . Error. workingDirectoryNotSupported
995- #endif
996978 }
997979
998980 var stdinPipe : [ Int32 ] = [ - 1 , - 1 ]
@@ -1778,8 +1760,6 @@ extension Process.Error: CustomStringConvertible {
17781760 switch self {
17791761 case . missingExecutableProgram( let program) :
17801762 return " could not find executable for ' \( program) ' "
1781- case . workingDirectoryNotSupported:
1782- return " workingDirectory is not supported in this platform "
17831763 }
17841764 }
17851765}
0 commit comments