浏览代码

ssh: fix height/width order in RequestPty example

The RequestPty function takes the size arguments in the order height,
then width, instead of the more common width, then height. 80 is a very
common width for a terminal, so when the example reads RequestPty(...,
80, 40, ...), it's easy to assume that the order is width-height.
Switching the order should make it more obvious what is going on.

Change-Id: I1d6266b1c0dcde5ee6e31a6d26d2dcaf14fec58a
Reviewed-on: https://go-review.googlesource.com/18290
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Henrik Hodne 10 年之前
父节点
当前提交
2cbd8ea802
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      ssh/example_test.go

+ 1 - 1
ssh/example_test.go

@@ -252,7 +252,7 @@ func ExampleSession_RequestPty() {
 		ssh.TTY_OP_OSPEED: 14400, // output speed = 14.4kbaud
 		ssh.TTY_OP_OSPEED: 14400, // output speed = 14.4kbaud
 	}
 	}
 	// Request pseudo terminal
 	// Request pseudo terminal
-	if err := session.RequestPty("xterm", 80, 40, modes); err != nil {
+	if err := session.RequestPty("xterm", 40, 80, modes); err != nil {
 		log.Fatal("request for pseudo terminal failed: ", err)
 		log.Fatal("request for pseudo terminal failed: ", err)
 	}
 	}
 	// Start remote shell
 	// Start remote shell