Fix log noise on Linux devices without WiFi: dynamic interface discovery in MachineInfoProvider#147
Merged
Merged
Conversation
- 使用 NetworkInterface.GetAllNetworkInterfaces() 动态查找无线网卡, 兼容 wlan0/wlp2s0/wlan1 等各种命名,无 WiFi 设备时跳过 iw 进程启动 - 启用 RedirectStandardError = true,彻底避免子进程 stderr 污染日志 Closes #146
Copilot
AI
changed the title
[WIP] Fix log noise from MachineInfoProvider on Linux without WiFi device
Fix log noise on Linux devices without WiFi: dynamic interface discovery in MachineInfoProvider
Jul 20, 2026
nnhy
marked this pull request as ready for review
July 20, 2026 11:32
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces log noise and unnecessary process spawning on Linux devices without WiFi by discovering wireless interfaces dynamically (instead of hardcoding wlan0) and by redirecting child-process stderr to prevent it from being inherited by the agent process.
Changes:
- Discover wireless interfaces at runtime via
NetworkInterface.GetAllNetworkInterfaces()and queryiw dev <if> linkonly for matching interfaces. - Enable
RedirectStandardError = truein theExecutehelper to avoid stderr leaking into parent logs.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
299
to
303
| CreateNoWindow = true, | ||
| WindowStyle = ProcessWindowStyle.Hidden, | ||
| RedirectStandardOutput = true, | ||
| //RedirectStandardError = true, | ||
| RedirectStandardError = true, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Linux machines without a wireless NIC,
MachineInfoProvider.Refresh()unconditionally spawnediw dev wlan0 linkon every heartbeat, causingcommand failed: No such device (-19)to flood logs via inherited stderr.Changes
MachineInfoProvider.cs): Replace hardcodedwlan0withNetworkInterface.GetAllNetworkInterfaces()filtered toWireless80211 + Up. When no wireless interfaces exist the list is empty, the loop is skipped entirely, andiwis never spawned. Also supports non-standard names (wlp2s0,wlan1, etc.) and multiple interfaces.Executehelper): EnableRedirectStandardError = trueso any residual child-process stderr is captured rather than inherited by the StarAgent process.