Skip to content

Commit 53c1afd

Browse files
author
linyuan.yang
committed
端口占用检查
1 parent 5a8783c commit 53c1afd

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# sbox
22

3+
## 0.0.7
4+
5+
### 新增
6+
7+
- 新增端口占用检查工具,可查看本地 TCP / UDP 端口被哪些进程监听或连接(支持 IPv4 / IPv6),并可一键结束占用进程,结束后自动重新检查。
8+
39
## 0.0.6
410

511
### 新增

‎packages/app/src-tauri/src/tools/port_check.rs‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,21 @@ mod tests {
114114
});
115115
assert!(found, "应能通过系统表找到本测试进程的监听套接字");
116116
}
117+
118+
#[cfg(windows)]
119+
#[test]
120+
fn kill_process_terminates_child() {
121+
let mut child = std::process::Command::new("ping")
122+
.args(["-n", "30", "127.0.0.1"])
123+
.spawn()
124+
.unwrap();
125+
kill_process(child.id()).unwrap();
126+
std::thread::sleep(std::time::Duration::from_millis(500));
127+
assert!(
128+
child.try_wait().unwrap().is_some(),
129+
"子进程应已被结束"
130+
);
131+
}
117132
}
118133

119134
#[cfg(windows)]

0 commit comments

Comments
 (0)