Using the very handy Curb from http://curb.rubyforge.org/…
Maybe I’m doing something wrong, but it seems that the mere presence
of an on_debug handler causes the exit code of a script to be “1”
instead of “0”.
Unfortunately my C skills are non-existent, so I don’t understand
Curb’s sources. The best I can do is provide this simple test case in
Ruby:
$ cat exit_code.rb
require "curl"
curl = Curl::Easy.new "http://www.google.com/"
curl.perform
$ ruby exit_code.rb ; echo $?
0
$ cat exit_code_on_debug.rb
require "curl"
curl = Curl::Easy.new "http://www.google.com/"
curl.on_debug { |type, data| true }
curl.perform
$ ruby exit_code_on_debug.rb ; echo $?
1
Using Curb 0.1.4, tried the above on Mac OS X 10.4 (ruby 1.8.6, curl
7.17.0) and CentOS 5 (ruby 1.8.5, curl 7.15.5)… same results.
Any hints, workaround, etc very much appreciated. – Thanks!
Background: I have some Rake tasks that call code involving Curl/Curb
with an on_debug handler attached (used to capture “Cookie:” headers
added by libcurl’s cookie engine). After the Curl/Curb stuff is
called, the exit code is “1” and Rake aborts, preventing follow-up
tasks from running.