fix: avoid VM name collisions in recovery commands

This commit is contained in:
Codex
2026-10-13 04:22:29 +03:00
parent e6cf7b7252
commit 0e86fffd54
2 changed files with 63 additions and 4 deletions
+4 -4
View File
@@ -210,21 +210,21 @@ def session_helper(command: str, manifest: Path) -> int:
if command == 'recover':
print('HydraOS local recovery. VMs keep running independently.\n'
'Ctrl+Alt+Shift+Left/Right switches workspaces; Ctrl+Alt+Shift+R releases input; Ctrl+Alt+Shift+U opens USB.\n'
'Enter a VM name to reconnect, s for a host shell, q to close this terminal.')
'Enter a VM name to reconnect, :shell for a host shell, :quit to close this terminal.')
while True:
try:
print(json.dumps([runtime.status(name) for name in data['names']], indent=2))
choice = input('hydra recovery> ').strip()
except (EOFError, KeyboardInterrupt):
return 0
if choice == 'q':
if choice == ':quit':
return 0
if choice == 's':
if choice == ':shell':
subprocess.run([os.environ.get('SHELL', '/bin/sh')])
elif choice in data['names']:
subprocess.Popen(_module_argv('reconnect:' + choice, manifest), start_new_session=True)
else:
print('Enter a configured VM name, s, or q.')
print('Enter a configured VM name, :shell, or :quit.')
if command.startswith('reconnect:'):
name = command.split(':', 1)[1]
# One viewer per VM inside this session; independent host view commands