fix(core): 所有子进程统一走 platform::child::quiet + 角色守卫(M213)
GUI 父进程(PE Subsystem = 2)spawn 控制台子进程时,Windows 会为子进程新建一块
控制台——桌面上就是「黑框闪一下」。改前 crates/core/src 有 21 处 Command::new,
只有 tree_kill 那一处带了 CREATE_NO_WINDOW,于是探 N 个 JDK 就闪 N 次 java -version。
- 新增 crates/core/src/platform/child.rs:唯一构造器 quiet(program),Windows 上统一
.creation_flags(CREATE_NO_WINDOW),其它平台原样返回。tree_kill 里那份就地合并进来,
不再保留第二份常量。
- 20 处 spawn 全部改走它(region_system / java{discover,manual,probe,proc,termux} /
addon exec / platform{linux_caps,macos_version,theme_probe,vk_probe,windows_version,
wallpaper/io})。
- launch/process.rs 零改动:游戏进程要 CREATE_NEW_PROCESS_GROUP 撑 taskkill /T,
带不带控制台窗口是产品决定。
- crates/core/tests/child_quiet.rs:按角色判「有没有绕开构造器」的守卫,外加构造器
本身的 4 条行为用例。三条变异(裸 Command::new / 别名 Spawn::new / 删掉 creation_flags)
都实测变红并已还原。
This commit is contained in:
1 parent
bb8be87c8f
commit
40a296471d
17 files changed
+417
-39
No files matched your search
@@ -14,7 +14,7 @@
|
||||
//! 两个纪律:①**不引依赖**——`tzutil` / `reg` 都是系统自带,`discover.rs` 早就有 `reg query`
|
||||
//! 的先例;②**不做网络探测**——探测(google 可达性)仍由调用方决定开不开。
|
||||
|
||||
use std::process::Command;
|
||||
use crate::platform::child::quiet;
|
||||
|
||||
use super::region::{Signals, GREATER_CHINA_TIMEZONES};
|
||||
|
||||
@@ -64,7 +64,7 @@ pub fn detect_signals() -> Signals {
|
||||
/// `tzutil /g` 的输出(失败为 `None`)。
|
||||
#[must_use]
|
||||
pub fn windows_timezone() -> Option<String> {
|
||||
let output = Command::new("tzutil").arg("/g").output().ok()?;
|
||||
let output = quiet("tzutil").arg("/g").output().ok()?;
|
||||
if !output.status.success() {
|
||||
return None;
|
||||
}
|
||||
@@ -75,7 +75,7 @@ pub fn windows_timezone() -> Option<String> {
|
||||
/// 系统的 locale 名(`HKCU\Control Panel\International` 的 `LocaleName`)。
|
||||
#[must_use]
|
||||
pub fn windows_locale() -> Option<String> {
|
||||
let output = Command::new("reg")
|
||||
let output = quiet("reg")
|
||||
.args([
|
||||
"query",
|
||||
"HKCU\\Control Panel\\International",
|
||||
|
||||
Reference in new issue
Block a user