diff --git a/.changes/fix-tauri-driver-stdout-pollution.md b/.changes/fix-tauri-driver-stdout-pollution.md new file mode 100644 index 000000000..dbe917df6 --- /dev/null +++ b/.changes/fix-tauri-driver-stdout-pollution.md @@ -0,0 +1,5 @@ +--- +'tauri-driver': 'patch:bug' +--- + +Prevent native WebDriver stdout from polluting tauri-driver's stdout used by test frameworks. diff --git a/crates/tauri-driver/src/webdriver.rs b/crates/tauri-driver/src/webdriver.rs index 76bb93884..73ce2b823 100644 --- a/crates/tauri-driver/src/webdriver.rs +++ b/crates/tauri-driver/src/webdriver.rs @@ -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 }