mirror of
https://github.com/coder/coder.git
synced 2025-07-06 15:41:45 +00:00
Builds on top of https://github.com/coder/coder/pull/16623/ and wires up the ReconnectingPTY server. This does nothing to wire up the web terminal yet but the added test demonstrates the functionality working. Other changes: * Refactors and moves the `SystemEnvInfo` interface to the `agent/usershell` package to address follow-up from https://github.com/coder/coder/pull/16623#discussion_r1967580249 * Marks `usershellinfo.Get` as deprecated. Consumers should use the `EnvInfoer` interface instead. --------- Co-authored-by: Mathias Fredriksson <mafredri@gmail.com> Co-authored-by: Danny Kopping <danny@coder.com>
18 lines
380 B
Go
18 lines
380 B
Go
package usershell
|
|
|
|
import "os/exec"
|
|
|
|
// Get returns the command prompt binary name.
|
|
// Deprecated: use SystemEnvInfo.UserShell instead.
|
|
func Get(username string) (string, error) {
|
|
_, err := exec.LookPath("pwsh.exe")
|
|
if err == nil {
|
|
return "pwsh.exe", nil
|
|
}
|
|
_, err = exec.LookPath("powershell.exe")
|
|
if err == nil {
|
|
return "powershell.exe", nil
|
|
}
|
|
return "cmd.exe", nil
|
|
}
|