Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cURL - notify about upload progress

I have script in Xcode, which runs automatically at the end of Archive operation. It's signing and submitting build to TestFlight service. The problem is that uploading takes a lot of time, and I can't see any progress.

As a notifier it is using apple script notifier:

notify () {
    /usr/bin/osascript -e "display notification \"$1\" with title \"Xcode\""
}
notify "Uploading to TestFlight"

cURL uploading is done here:

/usr/bin/curl "http://testflightapp.com/api/builds.json" \
-F file=@"/tmp/${PRODUCT_NAME}.ipa" \
-F dsym=@"/tmp/${PRODUCT_NAME}.dSYM.zip" \
-F api_token="${API_TOKEN}" \
-F team_token="${TEAM_TOKEN}" \
-F notes="Build uploaded automatically from Xcode."

I would be happy if I can see similar messages about 10, 20, etc... percents of uploading process.

Here is full script: https://gist.github.com/ealeksandrov/5808692

like image 225
Evgeny Aleksandrov Avatar asked Jun 18 '13 20:06

Evgeny Aleksandrov


People also ask

How to show progress curl?

curl features an alternative progress bar. When you invoke it with -# or the longer version –progress-bar, curl will show the transfer progress using a single “bar” on the screen instead of the default meter that shows a lot of data like amount of data, transfer speeds and times.

How do I upload a file using curl?

How to send a file using Curl? To upload a file, use the -d command-line option and begin data with the @ symbol. If you start the data with @, the rest should be the file's name from which Curl will read the data and send it to the server. Curl will use the file extension to send the correct MIME data type.

What does curl -- upload file do?

CURL upload file allows you to send data to a remote server. The command-line tool supports web forms integral to every web system. When you execute a CURL file upload [1] for any protocol (HTTP, FTP, SMTP, and others), you transfer data via URLs to and from a server.


1 Answers

Redirect the output somewhere and the progress bar will show up. The reason it is shut off in your case is that you've asked curl to send the downloaded data to stdout and then it shuts off the progress meter automatically to not mess up the output.

So, redirect with > in the shell or use one of curl's -o (lower case letter o) or -O (upper case letter o) options.

like image 88
Daniel Stenberg Avatar answered Oct 19 '22 06:10

Daniel Stenberg