Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit035ad33

Browse files
fix: initialize pseudo console with default size for SSH sessions [2.27] (#20490)
> Resolved an invalid parameter error (-2147024809) during PTY creationon Windows 11 22H2 (but not only) when connecting via JetBrains Toolboxwhich spawns the native SSH client with `-tt` forcing PTY allocationeven though there is no "terminal" on the client side to query its size.>> CreatePseudoConsole doesn't accept a 0x0 (zero width and zero height)console size and unfortunately, there is NO explicit documentation inthe official Microsoft documentation that states the minimum validvalues or explicitly prohibits 0x0.>> Looking at real-world implementations in the search results, allexamples use reasonable non-zero values.>> I tested this with a local Windows VM registered to dev.coder.com i.e.externally managed workspace.Relates to#20468Co-authored-by: Faur Ioan-Aurel <fioan89@gmail.com>
1 parent230b55b commit035ad33

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

‎pty/pty_windows.go‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,19 @@ func newPty(opt ...Option) (*ptyWindows, error) {
5454
returnnil,err
5555
}
5656

57-
consoleSize:=uintptr(80)+ (uintptr(80)<<16)
57+
// Default dimensions
58+
width,height:=80,80
5859
ifopts.sshReq!=nil {
59-
consoleSize=uintptr(opts.sshReq.Window.Width)+ (uintptr(opts.sshReq.Window.Height)<<16)
60+
ifw:=opts.sshReq.Window.Width;w>0&&w<=65535 {
61+
width=w
62+
}
63+
ifh:=opts.sshReq.Window.Height;h>0&&h<=65535 {
64+
height=h
65+
}
6066
}
67+
68+
consoleSize:=uintptr(width)+ (uintptr(height)<<16)
69+
6170
ret,_,err:=procCreatePseudoConsole.Call(
6271
consoleSize,
6372
uintptr(pty.inputRead.Fd()),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp