cURL / Mailing Lists / curl-library / Single Mail

curl-library

curl_easy_perform opens up new shell

From: Florian Wege <awaterknight_at_googlemail.com>
Date: Fri, 30 Oct 2015 21:18:34 +0100

Hello,

I am working on a small GUI application (wxWidgets) for Windows which
downloads files from a web server using libcurl. While the GUI framework
shows no terminal, everytime the curl_easy_perform function does its job
(in a separate thread), it opens up such shell for a split second. Since a
lot of files need to be transfered consecutively, it results in a
flickering and focus-grabbing annoyance -> users cannot control the GUI
properly anymore.

How to prevent libcurl from spawning shells?

    curl_global_init(CURL_GLOBAL_ALL);

    m_curl = curl_easy_init();

    curl_easy_setopt(m_curl, CURLOPT_URL, url.c_str());
    curl_easy_setopt(m_curl, CURLOPT_WRITEFUNCTION, write_string);

    curl_easy_setopt(m_curl, CURLOPT_WRITEDATA, target);
    curl_easy_setopt(m_curl, CURLOPT_FAILONERROR, true);

    CURLcode res = curl_easy_perform(m_curl);
    curl_easy_cleanup(m_curl);
    curl_global_cleanup();

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-10-30