Fix issues #103 and #104 (#106)

This commit is contained in:
Haoran Peng 2025-03-22 10:55:37 -07:00 committed by GitHub
parent 4025693dec
commit 3afe581c1f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1630,11 +1630,13 @@ inline void Popen::execute_process() noexcept(false)
try { try {
char err_buf[SP_MAX_ERR_BUF_SIZ] = {0,}; char err_buf[SP_MAX_ERR_BUF_SIZ] = {0,};
int read_bytes = util::read_atmost_n( FILE* err_fp = fdopen(err_rd_pipe, "r");
fdopen(err_rd_pipe, "r"), if (!err_fp) {
err_buf, close(err_rd_pipe);
SP_MAX_ERR_BUF_SIZ); throw OSError("fdopen failed", errno);
close(err_rd_pipe); }
int read_bytes = util::read_atmost_n(err_fp, err_buf, SP_MAX_ERR_BUF_SIZ);
fclose(err_fp);
if (read_bytes || strlen(err_buf)) { if (read_bytes || strlen(err_buf)) {
// Call waitpid to reap the child process // Call waitpid to reap the child process