fix zombie subprocesses by waiting on them
Also bump to 0.2.1.
This commit is contained in:
parent
c3463d7400
commit
612950b23a
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "opal"
|
name = "opal"
|
||||||
version = "0.2.0"
|
version = "0.2.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "GPL-3.0-or-later"
|
license = "GPL-3.0-or-later"
|
||||||
|
|
||||||
|
|
|
@ -210,9 +210,9 @@ fn handle_client(tls_stream: &mut ssl::SslStream<net::TcpStream>, cgi_config: &C
|
||||||
|
|
||||||
// Get appropriate response from either Opal or the CGI process.
|
// Get appropriate response from either Opal or the CGI process.
|
||||||
match get_response(&request[..read_bytes], cgi_config, &tls_stream) {
|
match get_response(&request[..read_bytes], cgi_config, &tls_stream) {
|
||||||
Ok((url, child)) => {
|
Ok((url, mut child)) => {
|
||||||
let mut buffer = vec![0u8; 4096];
|
let mut buffer = vec![0u8; 4096];
|
||||||
let mut stdout = child.stdout.expect("child process stdout not available");
|
let mut stdout = child.stdout.take().expect("child process stdout not available");
|
||||||
let mut num_sent = 0;
|
let mut num_sent = 0;
|
||||||
loop {
|
loop {
|
||||||
match stdout.read(&mut buffer) {
|
match stdout.read(&mut buffer) {
|
||||||
|
@ -228,6 +228,7 @@ fn handle_client(tls_stream: &mut ssl::SslStream<net::TcpStream>, cgi_config: &C
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
info!("\"{}\" → replied {} bytes", url, num_sent);
|
info!("\"{}\" → replied {} bytes", url, num_sent);
|
||||||
|
child.wait().expect("child process can't be waited for");
|
||||||
let mut stderr = child.stderr.expect("child process' stderr not available");
|
let mut stderr = child.stderr.expect("child process' stderr not available");
|
||||||
let mut errors = vec![];
|
let mut errors = vec![];
|
||||||
match stderr.read_to_end(&mut errors) {
|
match stderr.read_to_end(&mut errors) {
|
||||||
|
|
Reference in a new issue