Skip to content

RSDK-14081: support Interactive shell on windows#6099

Open
allisonschiang wants to merge 4 commits into
viamrobotics:mainfrom
allisonschiang:RSDK-14081
Open

RSDK-14081: support Interactive shell on windows#6099
allisonschiang wants to merge 4 commits into
viamrobotics:mainfrom
allisonschiang:RSDK-14081

Conversation

@allisonschiang

@allisonschiang allisonschiang commented Jun 9, 2026

Copy link
Copy Markdown
Member

This PR replaces the unix-only pty with a charmbracelet/xpty which works on both unix and windows.

Testing:
This update is on the server-side, so I need to set up a viam-server with these updates and then shell into it
Mac -> Windows before:

viam machine part shell --part-id 123
Info: Ensure machine part has a valid shell type service
rpc error: code = Unknown desc = shell not supported on windows yet; sorry

Mac -> Windows after:

rdk git:(RSDK-14081) ./bin/Darwin-arm64/viam-cli machine part shell --part-id 123
Info: Ensure machine part has a valid shell type service

Windows PowerShell                                                                                                                                                                                      
Copyright (C) Microsoft Corporation. All rights reserved.                                                                                                                                               
                                                                                                                                                                                                        
PS C:\Users\admin\Downloads\rdk> ls                                                                                                                                                                     
                                                                                                                                                                                                        
                                                                                                                                                                                                        
    Directory: C:\Users\admin\Downloads\rdk                                                                                                                                                             
                                                                                                                                                                                                        
                                                                                                                                                                                                        
Mode                LastWriteTime         Length Name                                                                                                                                                   
----                -------------         ------ ----                                                                                                                                                   
d-----         6/5/2026   6:38 PM                .artifact        

Also confirmed shelling into mac still works through windows -> mac running this viam-server

@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Jun 9, 2026
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jun 9, 2026
}
shellArgs = nil
shellEnv = nil
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

windows doesn't take the -i (interactive shell) or term input using nil here still works

cmd := exec.CommandContext(ctxCancel, defaultShellPath, "-i")
cmd.Env = []string{"TERM=xterm-256color"}
f, err := pty.Start(cmd)
cmd := exec.Command(defaultShellPath, shellArgs...)

@allisonschiang allisonschiang Jun 11, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we pass the ctxCancel into xpty.WaitProcess on line 134 because exec can't launch a conPTY process

see: golang/go#62708

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jun 11, 2026
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Jun 11, 2026
@allisonschiang allisonschiang marked this pull request as ready for review June 11, 2026 21:02
@allisonschiang allisonschiang requested review from a team, njooma and stuqdog and removed request for a team June 11, 2026 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test This pull request is marked safe to test from a trusted zone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants