]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool: init progress bar on demand
authorStefan Eissing <stefan@eissing.org>
Thu, 25 Jun 2026 08:42:17 +0000 (10:42 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 25 Jun 2026 09:09:19 +0000 (11:09 +0200)
Determine the terminal size on first invocation, not for all
transfers.

Closes #22164

src/tool_cb_prg.c

index 1af621dbaaa089765f5bc52029dbba681da50036..7d7f3a8d519ec628b8c762ff2958d73fd858b9cc 100644 (file)
@@ -129,6 +129,9 @@ int tool_progress_cb(void *clientp,
   curl_off_t total;
   curl_off_t point;
 
+  if(!bar->calls)
+    update_width(bar);
+
   /* Calculate expected transfer size. initial_size can be less than zero when
      indicating that we are expecting to get the filesize from the remote */
   if(bar->initial_size < 0) {
@@ -230,8 +233,6 @@ void progressbarinit(struct ProgressData *bar, struct OperationConfig *config)
   if(config->use_resume)
     bar->initial_size = config->resume_from;
 
-  update_width(bar);
-
   bar->out = tool_stderr;
   bar->tick = 150;
   bar->barmove = 1;