allow to build on solaris

This commit is contained in:
Adrien Delorme 2019-06-07 12:42:38 +02:00
parent 6fecd7d362
commit d16fd8a2b1
4 changed files with 13 additions and 7 deletions

View File

@ -118,8 +118,3 @@ var (
wrappedStdout *os.File
wrappedStderr *os.File
)
func init() {
// Initialize the platform-specific code
initPlatform()
}

View File

@ -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()
}

View File

@ -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")

View File

@ -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