aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/exp/ssh/session.go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2011-12-03 02:17:34 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-12-03 02:17:34 +0000
commit2fd401c8f190f1fe43e51a7f726f6ed6119a1f96 (patch)
tree7f76eff391f37fe6467ff4ffbc0c582c9959ea30 /libgo/go/exp/ssh/session.go
parent02e9018f1616b23f1276151797216717b3564202 (diff)
downloadgcc-2fd401c8f190f1fe43e51a7f726f6ed6119a1f96.zip
gcc-2fd401c8f190f1fe43e51a7f726f6ed6119a1f96.tar.gz
gcc-2fd401c8f190f1fe43e51a7f726f6ed6119a1f96.tar.bz2
libgo: Update to weekly.2011-11-02.
From-SVN: r181964
Diffstat (limited to 'libgo/go/exp/ssh/session.go')
-rw-r--r--libgo/go/exp/ssh/session.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/libgo/go/exp/ssh/session.go b/libgo/go/exp/ssh/session.go
index 13df2f0..77154f2 100644
--- a/libgo/go/exp/ssh/session.go
+++ b/libgo/go/exp/ssh/session.go
@@ -9,8 +9,8 @@ package ssh
import (
"encoding/binary"
+ "errors"
"io"
- "os"
)
// A Session represents a connection to a remote command or shell.
@@ -34,7 +34,7 @@ type Session struct {
// Setenv sets an environment variable that will be applied to any
// command executed by Shell or Exec.
-func (s *Session) Setenv(name, value string) os.Error {
+func (s *Session) Setenv(name, value string) error {
n, v := []byte(name), []byte(value)
nlen, vlen := stringLength(n), stringLength(v)
payload := make([]byte, nlen+vlen)
@@ -53,7 +53,7 @@ func (s *Session) Setenv(name, value string) os.Error {
var emptyModeList = []byte{0, 0, 0, 1, 0}
// RequestPty requests the association of a pty with the session on the remote host.
-func (s *Session) RequestPty(term string, h, w int) os.Error {
+func (s *Session) RequestPty(term string, h, w int) error {
buf := make([]byte, 4+len(term)+16+len(emptyModeList))
b := marshalString(buf, []byte(term))
binary.BigEndian.PutUint32(b, uint32(h))
@@ -73,9 +73,9 @@ func (s *Session) RequestPty(term string, h, w int) os.Error {
// Exec runs cmd on the remote host. Typically, the remote
// server passes cmd to the shell for interpretation.
// A Session only accepts one call to Exec or Shell.
-func (s *Session) Exec(cmd string) os.Error {
+func (s *Session) Exec(cmd string) error {
if s.started {
- return os.NewError("session already started")
+ return errors.New("session already started")
}
cmdLen := stringLength([]byte(cmd))
payload := make([]byte, cmdLen)
@@ -92,9 +92,9 @@ func (s *Session) Exec(cmd string) os.Error {
// Shell starts a login shell on the remote host. A Session only
// accepts one call to Exec or Shell.
-func (s *Session) Shell() os.Error {
+func (s *Session) Shell() error {
if s.started {
- return os.NewError("session already started")
+ return errors.New("session already started")
}
s.started = true
@@ -106,7 +106,7 @@ func (s *Session) Shell() os.Error {
}
// NewSession returns a new interactive session on the remote host.
-func (c *ClientConn) NewSession() (*Session, os.Error) {
+func (c *ClientConn) NewSession() (*Session, error) {
ch, err := c.openChan("session")
if err != nil {
return nil, err