File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,36 @@ extension Task: CustomStringConvertible {
5252 }
5353}
5454
55+ extension Task : Hashable {
56+ public var hashValue : Int {
57+ var result = launchPath. hashValue ^ ( workingDirectoryPath? . hashValue ?? 0 )
58+ for argument in arguments {
59+ result ^= argument. hashValue
60+ }
61+ for (key, value) in environment ?? [ : ] {
62+ result ^= key. hashValue ^ value. hashValue
63+ }
64+ return result
65+ }
66+ }
67+
68+ private func == < Key : Equatable , Value : Equatable > ( lhs: [ Key : Value ] ? , rhs: [ Key : Value ] ? ) -> Bool {
69+ switch ( lhs, rhs) {
70+ case let ( . Some( lhs) , . Some( rhs) ) :
71+ return lhs == rhs
72+
73+ case ( . None, . None) :
74+ return true
75+
76+ default :
77+ return false
78+ }
79+ }
80+
81+ public func == ( lhs: Task , rhs: Task ) -> Bool {
82+ return lhs. launchPath == rhs. launchPath && lhs. arguments == rhs. arguments && lhs. workingDirectoryPath == rhs. workingDirectoryPath && lhs. environment == rhs. environment
83+ }
84+
5585/// A private class used to encapsulate a Unix pipe.
5686private final class Pipe {
5787 /// The file descriptor for reading data.
You can’t perform that action at this time.
0 commit comments