Skip to content

optimize: add error log when closing the pipe failed. #2050

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/ngx_http_lua_pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -773,10 +773,21 @@ ngx_http_lua_ffi_pipe_spawn(ngx_http_lua_ffi_pipe_proc_t *proc,
}
}

close(in[0]);
close(out[1]);
if (close(in[0]) == -1) {
ngx_log_error(NGX_LOG_EMERG, ngx_cycle->log, ngx_errno,
"lua pipe failed to close the in[0]");
}

if (close(out[1]) == -1) {
ngx_log_error(NGX_LOG_EMERG, ngx_cycle->log, ngx_errno,
"lua pipe failed to close the out[1]");
}

if (!merge_stderr) {
close(err[1]);
if (close(err[1]) == -1) {
ngx_log_error(NGX_LOG_EMERG, ngx_cycle->log, ngx_errno,
"lua pipe failed to close the err[1]");
}
}

if (environ != NULL) {
Expand Down