ref: 3866de6a3e1c5309b68c7659f78ffd3bb8bff370
parent: d2f94c8a8effcbab02b0db0bccc4fa64dd616fc4
author: penny <penny@limitedideas.org>
date: Sun Oct 19 15:50:11 EDT 2025
move a readline hack to the generic readline file
--- a/index.html
+++ b/index.html
@@ -242,6 +242,9 @@
href="https://penny64.codeberg.page/hellclient-downloads/linux/hell">Linux</a></li>
<li><a
href="https://penny64.codeberg.page/hellclient-downloads/mac/hell">Mac</a></li>
+<li><a
+href="https://penny64.codeberg.page/hellclient-downloads/plan9/hell">Plan
+9</a></li>
</ul>
</body>
</html>
--- a/main.go
+++ b/main.go
@@ -3,8 +3,6 @@
import (
"context"
"fmt"
- "io"
- "os"
"runtime/debug"
"strconv"
"strings"
@@ -23,15 +21,7 @@
rl := hc.rl
client := *hc.client
-
- //Horrible io pipe hack
- //Replaces system stdout with the readline one
- r, w, _ := os.Pipe()
- os.Stdout = w
-
- go func() {- io.Copy(rl.Stdout(), r)
- }()
+ enablePipeHack(rl)
homeMap := hc.homeMap
debugMap := hc.debugMap
--- a/readline.go
+++ b/readline.go
@@ -2,6 +2,8 @@
package main
import (
+ "os"
+ "io"
native "github.com/ergochat/readline"
)
@@ -27,4 +29,15 @@
return nil, err
}
return &readline{instance}, nil+}
+
+func enablePipeHack(rl *readline) {+ //Horrible io pipe hack
+ //Replaces system stdout with the readline one
+ r, w, _ := os.Pipe()
+ os.Stdout = w
+
+ go func() {+ io.Copy(rl.Stdout(), r)
+ }()
}
--- a/readline_plan9.go
+++ b/readline_plan9.go
@@ -65,3 +65,6 @@
func (rl *readline) Readline() (string, error) {return rl.ReadLineWithConfig(&rl.config)
}
+
+func enablePipeHack(rl *readline) {+}
--- a/readme.md
+++ b/readme.md
@@ -53,3 +53,4 @@
* [Windows](https://penny64.codeberg.page/hellclient-downloads/win/hell.exe)
* [Linux](https://penny64.codeberg.page/hellclient-downloads/linux/hell)
* [Mac](https://penny64.codeberg.page/hellclient-downloads/mac/hell)
+* [Plan 9](https://penny64.codeberg.page/hellclient-downloads/plan9/hell)
--
⑨