In terminal this works:
/usr/bin/curl --connect-timeout 10 --max-time 60 https://en.wikipedia.org/wiki/The_Beatles -o /Users/username/Desktop/wikiData
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 909k 100 909k 0 0 2025k 0 --:--:-- --:--:-- --:--:-- 2025k
But in Xcode this does not:
let task = Process()
let pipe = Pipe()
task.launchPath = "/usr/bin/curl"
task.arguments = ["--connect-timeout","10","--max-time","60","en.wikipedia.org/wiki/The_Beatles","-o","/Users/username/Desktop/wikiData"]
task.standardOutput = pipe
task.launch()
task.waitUntilExit()
I get this:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
Warning: Failed to create the file /Users/username/Desktop/wikiData:
Warning: Operation not permitted
curl: (23) Failed writing received data to disk/application
How do I give curl permission to write to disk? In Sandbox I checked "Network Incoming/Outgoing" to be able to talk to wikipedia, and set "File Access/User Selected File/Read/Write" but that doesn't seem to apply to curl. If I leave off "-o ..." I get no error. But I also seem to get no data. Ideas? Thanks.