allow to build on solaris
This commit is contained in:
parent
6fecd7d362
commit
d16fd8a2b1
|
@ -118,8 +118,3 @@ var (
|
||||||
wrappedStdout *os.File
|
wrappedStdout *os.File
|
||||||
wrappedStderr *os.File
|
wrappedStderr *os.File
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
// Initialize the platform-specific code
|
|
||||||
initPlatform()
|
|
||||||
}
|
|
||||||
|
|
|
@ -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()
|
||||||
|
}
|
|
@ -44,7 +44,7 @@ func getWidthFd(stdoutFd int) int {
|
||||||
return int(ws.Col)
|
return int(ws.Col)
|
||||||
}
|
}
|
||||||
|
|
||||||
func initPlatform() {
|
func init() {
|
||||||
// The standard streams are passed in via extra file descriptors.
|
// The standard streams are passed in via extra file descriptors.
|
||||||
wrappedStdin = os.NewFile(uintptr(3), "stdin")
|
wrappedStdin = os.NewFile(uintptr(3), "stdin")
|
||||||
wrappedStdout = os.NewFile(uintptr(4), "stdout")
|
wrappedStdout = os.NewFile(uintptr(4), "stdout")
|
||||||
|
|
|
@ -13,7 +13,7 @@ func getWidth() int {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func initPlatform() {
|
func init() {
|
||||||
wrappedStdin = openConsole("CONIN$", os.Stdin)
|
wrappedStdin = openConsole("CONIN$", os.Stdin)
|
||||||
wrappedStdout = openConsole("CONOUT$", os.Stdout)
|
wrappedStdout = openConsole("CONOUT$", os.Stdout)
|
||||||
wrappedStderr = wrappedStdout
|
wrappedStderr = wrappedStdout
|
||||||
|
|
Loading…
Reference in New Issue