fix(landerctl): output curl error if request fails
ci/woodpecker/push/docker Pipeline was successful
Details
ci/woodpecker/push/docker Pipeline was successful
Details
parent
e3c3f3b90a
commit
46b404acac
|
@ -124,6 +124,9 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
curl_easy_setopt(ctx.curl, CURLOPT_HTTPHEADER, ctx.headers);
|
curl_easy_setopt(ctx.curl, CURLOPT_HTTPHEADER, ctx.headers);
|
||||||
|
|
||||||
|
char curl_err_msg[CURL_ERROR_SIZE];
|
||||||
|
curl_easy_setopt(ctx.curl, CURLOPT_ERRORBUFFER, curl_err_msg);
|
||||||
|
|
||||||
int exit_code = 0;
|
int exit_code = 0;
|
||||||
|
|
||||||
if (curl_easy_perform(ctx.curl) == CURLE_OK) {
|
if (curl_easy_perform(ctx.curl) == CURLE_OK) {
|
||||||
|
@ -145,7 +148,7 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Libcurl encountered an error.\n");
|
fprintf(stderr, "Libcurl encountered an error: %s\n", curl_err_msg);
|
||||||
exit_code = 4;
|
exit_code = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,10 +112,10 @@ landerctl_err landerctl_post_file(landerctl_ctx *ctx) {
|
||||||
|
|
||||||
ctx->headers = curl_slist_append(ctx->headers, content_type_header);
|
ctx->headers = curl_slist_append(ctx->headers, content_type_header);
|
||||||
} else {
|
} else {
|
||||||
printf("Couldn't determine mime type; skipping Content-Type header");
|
printf("Couldn't determine mime type; skipping Content-Type header\n");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
printf("Couldn't load magic file; skipping Content-Type header");
|
printf("Couldn't load magic file; skipping Content-Type header\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
char s[strlen(ctx->arg) + 1];
|
char s[strlen(ctx->arg) + 1];
|
||||||
|
|
Loading…
Reference in New Issue