fix: don't inherit stdout from parent

This commit is contained in:
Sam Maister 2026-02-02 15:27:11 +00:00
parent 20b99f9281
commit c509a8e549
No known key found for this signature in database
2 changed files with 16 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
'tauri-driver': 'patch:bug'
---
Prevent native WebDriver stdout from polluting tauri-driver's stdout used by test frameworks.

View File

@ -1,9 +1,12 @@
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
// Copyright 2019-2026 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use crate::cli::Args;
use std::{env::current_dir, process::Command};
use std::{
env::current_dir,
process::{Command, Stdio},
};
// the name of the binary to find in $PATH
#[cfg(target_os = "linux")]
@ -48,5 +51,11 @@ pub fn native(args: &Args) -> Command {
cmd.env("TAURI_WEBVIEW_AUTOMATION", "true"); // 2.x
cmd.arg(format!("--port={}", args.native_port));
cmd.arg(format!("--host={}", args.native_host));
// Don't inherit stdout from parent to prevent native WebDriver binary/HTTP protocol data
// from corrupting tauri-driver's stdout (which gets captured by the test framework).
// Keep stderr inherited so WebDriver logs/errors are still visible.
cmd.stdout(Stdio::null());
cmd
}