MCPcopy Create free account
hub / github.com/apache/cloudberry / pclose_check

Function pclose_check

src/common/exec.c:399–424  ·  view source on GitHub ↗

* pclose() plus useful error reporting */

Source from the content-addressed store, hash-verified

397 * pclose() plus useful error reporting
398 */
399int
400pclose_check(FILE *stream)
401{
402 int exitstatus;
403 char *reason;
404
405 exitstatus = pclose(stream);
406
407 if (exitstatus == 0)
408 return 0; /* all is well */
409
410 if (exitstatus == -1)
411 {
412 /* pclose() itself failed, and hopefully set errno */
413 log_error(errcode(ERRCODE_SYSTEM_ERROR),
414 _("%s() failed: %m"), "pclose");
415 }
416 else
417 {
418 reason = wait_result_to_str(exitstatus);
419 log_error(errcode(ERRCODE_SYSTEM_ERROR),
420 "%s", reason);
421 pfree(reason);
422 }
423 return exitstatus;
424}
425
426/*
427 * set_pglocale_pgservice

Callers 1

pipe_read_lineFunction · 0.85

Calls 3

wait_result_to_strFunction · 0.85
pfreeFunction · 0.70
errcodeFunction · 0.50

Tested by

no test coverage detected