Skip to content

Commit

Permalink
feat: avoid creating zombie processes
Browse files Browse the repository at this point in the history
  • Loading branch information
McPatate committed Nov 15, 2023
1 parent dfebbd0 commit 86a0317
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/testbed/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use std::{path::Path, process::Stdio};
use anyhow::anyhow;
use serde::{Deserialize, Serialize};
use tokio::{io::AsyncReadExt, process::Command};
use tracing::debug;

use crate::parse_env;

Expand Down Expand Up @@ -52,6 +51,7 @@ async fn pytest_runner(
.ok_or(anyhow!("failed to take stdout"))?
.read_to_string(&mut stdout)
.await?;
child.wait().await?;

// XXX: the pytest command can still fail even after the compilation check
// the above check should prevent an error, but better safe than sorry
Expand Down Expand Up @@ -124,6 +124,7 @@ async fn cargo_runner(
.ok_or(anyhow!("failed to take stdout"))?
.read_to_string(&mut stdout)
.await?;
child.wait().await?;
let lines = stdout.split_terminator('\n');
let mut passed = 0;
let mut failed = 0;
Expand Down Expand Up @@ -173,6 +174,7 @@ async fn jest_runner(
.ok_or(anyhow!("failed to take stderr"))?
.read_to_string(&mut stderr)
.await?;
child.wait().await?;
let lines = stderr.split_terminator('\n');
let mut passed = 0f32;
let mut failed = 0f32;
Expand Down Expand Up @@ -228,6 +230,7 @@ async fn vitest_runner(
.ok_or(anyhow!("failed to take stdout"))?
.read_to_string(&mut stdout)
.await?;
child.wait().await?;
let lines = stdout.split_terminator('\n');
let mut passed = 0f32;
let mut failed = 0f32;
Expand Down

0 comments on commit 86a0317

Please sign in to comment.