Skip to content

Commit

Permalink
Merge pull request #63 from Carthage/fix-task-description
Browse files Browse the repository at this point in the history
Quote whitespace-containing arguments in Task.description
  • Loading branch information
mdiep authored Jul 5, 2016
2 parents 375d21f + 9e4b12e commit cc4b2e2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ReactiveTask/Task.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,19 @@ public struct Task {
}
}

private extension String {
var escaped: String {
if rangeOfCharacterFromSet(.whitespaceCharacterSet()) != nil {
return "\"\(self)\""
} else {
return self
}
}
}

extension Task: CustomStringConvertible {
public var description: String {
return "\(launchPath) \(arguments.joinWithSeparator(" "))"
return "\(launchPath) \(arguments.map { $0.escaped }.joinWithSeparator(" "))"
}
}

Expand Down

0 comments on commit cc4b2e2

Please sign in to comment.