aboutsummaryrefslogtreecommitdiff
path: root/src/platform
diff options
context:
space:
mode:
Diffstat (limited to 'src/platform')
-rw-r--r--src/platform/mod.rs4
-rw-r--r--src/platform/windows.rs20
2 files changed, 21 insertions, 3 deletions
diff --git a/src/platform/mod.rs b/src/platform/mod.rs
index 42b9e128..82a6704d 100644
--- a/src/platform/mod.rs
+++ b/src/platform/mod.rs
@@ -26,7 +26,9 @@ pub enum Signal {
}
pub(crate) fn detached_custom_command_process(command: &str) -> std::process::Command {
- detached_custom_command_process_platform(command)
+ let mut process = detached_custom_command_process_platform(command);
+ configure_background_command(&mut process);
+ process
}
pub(crate) fn pane_custom_command_pty_builder(command: &str) -> portable_pty::CommandBuilder {
diff --git a/src/platform/windows.rs b/src/platform/windows.rs
index 46c75141..5b0d647f 100644
--- a/src/platform/windows.rs
+++ b/src/platform/windows.rs
@@ -671,7 +671,7 @@ mod tests {
const CONSOLE_TEST_CHILD_ENV: &str = "HERDR_TEST_CONSOLE_CHILD_MODE";
#[test]
- fn background_and_server_daemon_commands_do_not_have_consoles() {
+ fn windows_background_and_server_daemon_commands_do_not_have_consoles() {
if let Some(mode) = std::env::var_os(CONSOLE_TEST_CHILD_ENV) {
assert!(
unsafe { GetConsoleWindow() }.is_null(),
@@ -696,7 +696,7 @@ mod tests {
for (mode, configure) in configurations {
let mut child = Command::new(&test_exe);
child
- .arg("background_and_server_daemon_commands_do_not_have_consoles")
+ .arg("windows_background_and_server_daemon_commands_do_not_have_consoles")
.env(CONSOLE_TEST_CHILD_ENV, mode)
.stdin(Stdio::null())
.stdout(Stdio::null())
@@ -710,6 +710,22 @@ mod tests {
);
}
+ let command = format!(
+ r#""{}" windows_background_and_server_daemon_commands_do_not_have_consoles"#,
+ test_exe.display()
+ );
+ let status = crate::platform::detached_custom_command_process(&command)
+ .env(CONSOLE_TEST_CHILD_ENV, "detached custom command descendant")
+ .stdin(Stdio::null())
+ .stdout(Stdio::null())
+ .stderr(Stdio::null())
+ .status()
+ .expect("spawn detached custom command test child");
+ assert!(
+ status.success(),
+ "detached custom command descendant opened or inherited a console"
+ );
+
if allocated_console {
unsafe {
FreeConsole();