Skip to content

Commit 612950b

Browse files
committed
fix zombie subprocesses by waiting on them
Also bump to 0.2.1.
1 parent c3463d7 commit 612950b

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "opal"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
edition = "2021"
55
license = "GPL-3.0-or-later"
66

src/main.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,9 @@ fn handle_client(tls_stream: &mut ssl::SslStream<net::TcpStream>, cgi_config: &C
210210

211211
// Get appropriate response from either Opal or the CGI process.
212212
match get_response(&request[..read_bytes], cgi_config, &tls_stream) {
213-
Ok((url, child)) => {
213+
Ok((url, mut child)) => {
214214
let mut buffer = vec![0u8; 4096];
215-
let mut stdout = child.stdout.expect("child process stdout not available");
215+
let mut stdout = child.stdout.take().expect("child process stdout not available");
216216
let mut num_sent = 0;
217217
loop {
218218
match stdout.read(&mut buffer) {
@@ -228,6 +228,7 @@ fn handle_client(tls_stream: &mut ssl::SslStream<net::TcpStream>, cgi_config: &C
228228
}
229229
}
230230
info!("\"{}\" → replied {} bytes", url, num_sent);
231+
child.wait().expect("child process can't be waited for");
231232
let mut stderr = child.stderr.expect("child process' stderr not available");
232233
let mut errors = vec![];
233234
match stderr.read_to_end(&mut errors) {

0 commit comments

Comments
 (0)