Skip to content

Commit cc8f283

Browse files
committed
Fix wifi-scan command to use subprocess.run instead of shell function
1 parent de42e33 commit cc8f283

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

gonotego/command_center/wifi_commands.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""WiFi command handlers for Go Note Go using NetworkManager."""
2+
import subprocess
23
from gonotego.command_center import registry
34
from gonotego.command_center import system_commands
45
from gonotego.settings import wifi
@@ -150,10 +151,13 @@ def scan_wifi_networks():
150151
"""Scan for available WiFi networks."""
151152
try:
152153
# Ensure the WiFi adapter is on
153-
shell('sudo nmcli radio wifi on')
154+
subprocess.run(['sudo', 'nmcli', 'radio', 'wifi', 'on'], check=True)
154155

155156
# Scan for networks
156-
result = shell('nmcli -t -f SSID,SIGNAL,SECURITY device wifi list')
157+
result = subprocess.run(
158+
['nmcli', '-t', '-f', 'SSID,SIGNAL,SECURITY', 'device', 'wifi', 'list'],
159+
capture_output=True, text=True, check=True
160+
)
157161

158162
networks = []
159163
for line in result.stdout.strip().split('\n'):

0 commit comments

Comments
 (0)