Skip to content

Commit 50060d8

Browse files
committed
Fix windows types
Signed-off-by: Spike Curtis <spike@coder.com>
1 parent eaabb3a commit 50060d8

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

pty/pty_windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var (
2222
)
2323

2424
// See: https://docs.microsoft.com/en-us/windows/console/creating-a-pseudoconsole-session
25-
func newPty(opt ...Option) (PTY, error) {
25+
func newPty(opt ...Option) (*ptyWindows, error) {
2626
var opts ptyOptions
2727
for _, o := range opt {
2828
o(&opts)

pty/start_windows.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717

1818
// Allocates a PTY and starts the specified command attached to it.
1919
// See: https://docs.microsoft.com/en-us/windows/console/creating-a-pseudoconsole-session#creating-the-hosted-process
20-
func startPty(cmd *exec.Cmd, opt ...StartOption) (_ PTY, _ Process, retErr error) {
20+
func startPty(cmd *exec.Cmd, opt ...StartOption) (_ PTYCmd, _ Process, retErr error) {
2121
var opts startOptions
2222
for _, o := range opt {
2323
o(&opts)
@@ -46,18 +46,17 @@ func startPty(cmd *exec.Cmd, opt ...StartOption) (_ PTY, _ Process, retErr error
4646
return nil, nil, err
4747
}
4848

49-
pty, err := newPty(opts.ptyOpts...)
49+
winPty, err := newPty(opts.ptyOpts...)
5050
if err != nil {
5151
return nil, nil, err
5252
}
5353
defer func() {
5454
if retErr != nil {
5555
// we hit some error finishing setup; close pty, so
5656
// we don't leak the kernel resources associated with it
57-
_ = pty.Close()
57+
_ = winPty.Close()
5858
}
5959
}()
60-
winPty := pty.(*ptyWindows)
6160
if winPty.opts.sshReq != nil {
6261
cmd.Env = append(cmd.Env, fmt.Sprintf("SSH_TTY=%s", winPty.Name()))
6362
}
@@ -130,7 +129,7 @@ func startPty(cmd *exec.Cmd, opt ...StartOption) (_ PTY, _ Process, retErr error
130129
return nil, nil, errI
131130
}
132131
go wp.waitInternal()
133-
return pty, wp, nil
132+
return winPty, wp, nil
134133
}
135134

136135
// Taken from: https://github.com/microsoft/hcsshim/blob/7fbdca16f91de8792371ba22b7305bf4ca84170a/internal/exec/exec.go#L476

0 commit comments

Comments
 (0)