diff --git a/helper/wrappedreadline/wrappedreadline.go b/helper/wrappedreadline/wrappedreadline.go index 3bf7db0a0..67cb80653 100644 --- a/helper/wrappedreadline/wrappedreadline.go +++ b/helper/wrappedreadline/wrappedreadline.go @@ -118,8 +118,3 @@ var ( wrappedStdout *os.File wrappedStderr *os.File ) - -func init() { - // Initialize the platform-specific code - initPlatform() -} diff --git a/helper/wrappedreadline/wrappedreadline_solaris.go b/helper/wrappedreadline/wrappedreadline_solaris.go new file mode 100644 index 000000000..26c4e6c7b --- /dev/null +++ b/helper/wrappedreadline/wrappedreadline_solaris.go @@ -0,0 +1,11 @@ +package wrappedreadline + +// getWidth impl for Solaris +func getWidth() int { + return 80 +} + +// get width of the terminal +func getWidthFd(stdoutFd int) int { + return getWidth() +} diff --git a/helper/wrappedreadline/wrappedreadline_unix.go b/helper/wrappedreadline/wrappedreadline_unix.go index 130f2987a..8db87d1fa 100644 --- a/helper/wrappedreadline/wrappedreadline_unix.go +++ b/helper/wrappedreadline/wrappedreadline_unix.go @@ -44,7 +44,7 @@ func getWidthFd(stdoutFd int) int { return int(ws.Col) } -func initPlatform() { +func init() { // The standard streams are passed in via extra file descriptors. wrappedStdin = os.NewFile(uintptr(3), "stdin") wrappedStdout = os.NewFile(uintptr(4), "stdout") diff --git a/helper/wrappedreadline/wrappedreadline_windows.go b/helper/wrappedreadline/wrappedreadline_windows.go index 459479af9..fc1793409 100644 --- a/helper/wrappedreadline/wrappedreadline_windows.go +++ b/helper/wrappedreadline/wrappedreadline_windows.go @@ -13,7 +13,7 @@ func getWidth() int { return 0 } -func initPlatform() { +func init() { wrappedStdin = openConsole("CONIN$", os.Stdin) wrappedStdout = openConsole("CONOUT$", os.Stdout) wrappedStderr = wrappedStdout