Skip to content

Commit

Permalink
Fix 'objdump' call not working with Xcode 13.3 command line tools
Browse files Browse the repository at this point in the history
  • Loading branch information
hujunfeng committed Apr 11, 2022
1 parent 636d54b commit d89eed0
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions Source/CarthageKit/MachHeader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,25 @@ extension MachHeader {
// This is the command `otool -h` actually invokes
let task = Task("/usr/bin/xcrun", arguments: [
"objdump",
"-macho",
"-private-header",
"-non-verbose",
"--macho",
"--private-header",
"--non-verbose",
url.resolvingSymlinksInPath().path,
]
)

return task.launch(standardInput: nil)
.flatMapError { _ -> SignalProducer<TaskEvent<Data>, TaskError> in
// Fallback for 'objdump' in LLVM <9.0.0 (Xcode <11.4) which uses `-` as option prefix instead of `--`
Task("/usr/bin/xcrun", arguments: [
"objdump",
"-macho",
"-private-header",
"-non-verbose",
url.resolvingSymlinksInPath().path,
]
).launch(standardInput: nil)
}
.ignoreTaskData()
.map { String(data: $0, encoding: .utf8) ?? "" }
.filter { !$0.isEmpty }
Expand Down

0 comments on commit d89eed0

Please sign in to comment.