2
2
mirror of https://github.com/Hilbis/Hilbish synced 2025-07-05 10:32:03 +00:00

Compare commits

...

5 Commits

3 changed files with 9 additions and 1 deletions

View File

@ -8,6 +8,7 @@
### Fixed
- Skip over file and prevent panic if info cannot be retrieved during file completion (due to permission error or anything else)
- Apply environment variables properly after 2.3 shell interpreter changes
- hilbish.sink.readAll() function now reads data that doesn't end in a newline
## [2.3.3] - 2024-11-04
### Fixed

View File

@ -44,7 +44,7 @@ function hilbish.run(cmd, streams)
end
local out = hilbish.snail:run(cmd, {sinks = sinks})
local returns = {out}
local returns = {out.exitCode}
if type(streams) == 'boolean' and not streams then
table.insert(returns, sinks.out:readAll())

View File

@ -94,11 +94,17 @@ func luaSinkReadAll(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
return nil, err
}
if s.autoFlush {
s.Rw.Flush()
}
lines := []string{}
for {
line, err := s.Rw.ReadString('\n')
if err != nil {
if err == io.EOF {
// We still want to add the data we read
lines = append(lines, line)
break
}
@ -227,6 +233,7 @@ func luaSinkAutoFlush(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
func NewSink(rtm *rt.Runtime, Rw io.ReadWriter) *Sink {
s := &Sink{
Rw: bufio.NewReadWriter(bufio.NewReader(Rw), bufio.NewWriter(Rw)),
autoFlush: true,
}
s.UserData = sinkUserData(rtm, s)