I love the way that this topic is presented. So well done.
I do have one question though. When we build our playground, we create this function
func pathTo(command: String) async -> String {
await runCommand("/bin/zsh", with: ["-c", "which \(command)"])
}
yet, when you start to use the sips
command, you don’t use it. In stead, you do this:
Task {
let sipsPath = await runCommand("/bin/zsh", with: ["-c", "which sips"])
let args = ["--getProperty", "all", imagePath]
let imageData = await runCommand(sipsPath, with: args)
print(imageData)
}
Why not just use this instead?
Task {
let commandPath = await pathTo(command: "sips")
let args = ["--getProperty", "all", imagePath]
let imageData = await runCommand(commandPath, with: args)
print(imageData)
}