test: fix Chrome temp-dir cleanup test on Windows (#766)
This commit is contained in:
@@ -587,6 +587,28 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use crate::test_utils::EnvGuard;
|
use crate::test_utils::EnvGuard;
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
fn spawn_noop_child() -> Child {
|
||||||
|
Command::new("/bin/sh")
|
||||||
|
.args(["-c", "exit 0"])
|
||||||
|
.stdin(Stdio::null())
|
||||||
|
.stdout(Stdio::null())
|
||||||
|
.stderr(Stdio::null())
|
||||||
|
.spawn()
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
fn spawn_noop_child() -> Child {
|
||||||
|
Command::new("cmd.exe")
|
||||||
|
.args(["/C", "exit 0"])
|
||||||
|
.stdin(Stdio::null())
|
||||||
|
.stdout(Stdio::null())
|
||||||
|
.stderr(Stdio::null())
|
||||||
|
.spawn()
|
||||||
|
.unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_find_chrome_returns_some_on_host() {
|
fn test_find_chrome_returns_some_on_host() {
|
||||||
// This test only makes sense on systems with Chrome installed
|
// This test only makes sense on systems with Chrome installed
|
||||||
@@ -817,13 +839,7 @@ mod tests {
|
|||||||
// Simulate a ChromeProcess with a temp dir but a dummy child.
|
// Simulate a ChromeProcess with a temp dir but a dummy child.
|
||||||
// We can't actually spawn Chrome here, but we can verify the Drop
|
// We can't actually spawn Chrome here, but we can verify the Drop
|
||||||
// logic by creating a small helper process.
|
// logic by creating a small helper process.
|
||||||
let child = Command::new("echo")
|
let child = spawn_noop_child();
|
||||||
.arg("test")
|
|
||||||
.stdin(Stdio::null())
|
|
||||||
.stdout(Stdio::null())
|
|
||||||
.stderr(Stdio::null())
|
|
||||||
.spawn()
|
|
||||||
.unwrap();
|
|
||||||
let _process = ChromeProcess {
|
let _process = ChromeProcess {
|
||||||
child,
|
child,
|
||||||
ws_url: String::new(),
|
ws_url: String::new(),
|
||||||
|
|||||||
Reference in New Issue
Block a user