Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@MerlinDMC
Created December 11, 2015 11:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save MerlinDMC/57d6043067e0bad8e2af to your computer and use it in GitHub Desktop.
Save MerlinDMC/57d6043067e0bad8e2af to your computer and use it in GitHub Desktop.
diff -Naur src/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/terminal_solaris.go src_patched/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/terminal_solaris.go
--- src/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/terminal_solaris.go 1970-01-01 00:00:00.000000000 +0000
+++ src_patched/github.com/fsouza/go-dockerclient/external/github.com/Sirupsen/logrus/terminal_solaris.go 2015-12-11 11:23:35.298699379 +0000
@@ -0,0 +1,14 @@
+// Based on ssh/terminal:
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build solaris
+
+package logrus
+
+// IsTerminal returns true if the given file descriptor is a terminal.
+// Since the needed syscalls are mising on Illumos/Solaris we're just returning false here
+func IsTerminal() bool {
+ return false
+}
diff -Naur src/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/stat_solaris.go src_patched/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/stat_solaris.go
--- src/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/stat_solaris.go 1970-01-01 00:00:00.000000000 +0000
+++ src_patched/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/stat_solaris.go 2015-12-11 11:16:00.626669667 +0000
@@ -0,0 +1,17 @@
+// +build solaris
+
+package system
+
+import (
+ "syscall"
+)
+
+// fromStatT creates a system.StatT type from a syscall.Stat_t type
+func fromStatT(s *syscall.Stat_t) (*StatT, error) {
+ return &StatT{size: s.Size,
+ mode: uint32(s.Mode),
+ uid: s.Uid,
+ gid: s.Gid,
+ rdev: uint64(s.Rdev),
+ mtim: s.Mtim}, nil
+}
diff -Naur src/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/stat_unsupported.go src_patched/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/stat_unsupported.go
--- src/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/stat_unsupported.go 2015-12-11 11:42:44.901262257 +0000
+++ src_patched/github.com/fsouza/go-dockerclient/external/github.com/docker/docker/pkg/system/stat_unsupported.go 2015-12-11 11:24:26.954935253 +0000
@@ -1,4 +1,4 @@
-// +build !linux,!windows,!freebsd
+// +build !linux,!windows,!freebsd,!solaris
package system
diff -Naur src/golang.org/x/crypto/ssh/terminal/util_solaris.go src_patched/golang.org/x/crypto/ssh/terminal/util_solaris.go
--- src/golang.org/x/crypto/ssh/terminal/util_solaris.go 1970-01-01 00:00:00.000000000 +0000
+++ src_patched/golang.org/x/crypto/ssh/terminal/util_solaris.go 2015-12-11 11:38:05.340868315 +0000
@@ -0,0 +1,86 @@
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build solaris
+
+// Package terminal provides support functions for dealing with terminals, as
+// commonly found on UNIX systems.
+//
+// Putting a terminal into raw mode is the most common requirement:
+//
+// oldState, err := terminal.MakeRaw(0)
+// if err != nil {
+// panic(err)
+// }
+// defer terminal.Restore(0, oldState)
+package terminal // import "golang.org/x/crypto/ssh/terminal"
+
+import (
+ "fmt"
+ "io"
+ "syscall"
+)
+
+// State contains the state of a terminal.
+type State struct {
+ termios syscall.Termios
+}
+
+// IsTerminal returns true if the given file descriptor is a terminal.
+func IsTerminal(fd int) bool {
+ return false
+}
+
+// MakeRaw put the terminal connected to the given file descriptor into raw
+// mode and returns the previous state of the terminal so that it can be
+// restored.
+func MakeRaw(fd int) (*State, error) {
+ return nil, fmt.Errorf("unsupported")
+}
+
+// GetState returns the current state of a terminal which may be useful to
+// restore the terminal after a signal.
+func GetState(fd int) (*State, error) {
+ return nil, fmt.Errorf("unsupported")
+}
+
+// Restore restores the terminal connected to the given file descriptor to a
+// previous state.
+func Restore(fd int, state *State) error {
+ return fmt.Errorf("unsupported")
+}
+
+// GetSize returns the dimensions of the given terminal.
+func GetSize(fd int) (width, height int, err error) {
+ return 0, 0, fmt.Errorf("unsupported")
+}
+
+// ReadPassword reads a line of input from a terminal without local echo. This
+// is commonly used for inputting passwords and other sensitive data. The slice
+// returned does not include the \n.
+func ReadPassword(fd int) ([]byte, error) {
+ var buf [16]byte
+ var ret []byte
+ for {
+ n, err := syscall.Read(fd, buf[:])
+ if err != nil {
+ return nil, err
+ }
+ if n == 0 {
+ if len(ret) == 0 {
+ return nil, io.EOF
+ }
+ break
+ }
+ if buf[n-1] == '\n' {
+ n--
+ }
+ ret = append(ret, buf[:n]...)
+ if n < len(buf) {
+ break
+ }
+ }
+
+ return ret, nil
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment