Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
2d75a453
Commit
2d75a453
authored
Oct 27, 2023
by
Jeffrey Morgan
Browse files
close input channel when receiving `io.EOF`
parent
47486096
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
9 deletions
+1
-9
cmd/cmd.go
cmd/cmd.go
+0
-1
readline/readline.go
readline/readline.go
+1
-8
No files found.
cmd/cmd.go
View file @
2d75a453
...
@@ -536,7 +536,6 @@ func generateInteractive(cmd *cobra.Command, model string) error {
...
@@ -536,7 +536,6 @@ func generateInteractive(cmd *cobra.Command, model string) error {
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
defer
scanner
.
Close
()
var
wordWrap
bool
var
wordWrap
bool
termType
:=
os
.
Getenv
(
"TERM"
)
termType
:=
os
.
Getenv
(
"TERM"
)
...
...
readline/readline.go
View file @
2d75a453
...
@@ -211,10 +211,6 @@ func (i *Instance) Readline() (string, error) {
...
@@ -211,10 +211,6 @@ func (i *Instance) Readline() (string, error) {
}
}
}
}
func
(
i
*
Instance
)
Close
()
{
i
.
Terminal
.
Close
()
}
func
(
i
*
Instance
)
HistoryEnable
()
{
func
(
i
*
Instance
)
HistoryEnable
()
{
i
.
History
.
Enabled
=
true
i
.
History
.
Enabled
=
true
}
}
...
@@ -239,6 +235,7 @@ func (t *Terminal) ioloop() {
...
@@ -239,6 +235,7 @@ func (t *Terminal) ioloop() {
for
{
for
{
r
,
_
,
err
:=
buf
.
ReadRune
()
r
,
_
,
err
:=
buf
.
ReadRune
()
if
err
!=
nil
{
if
err
!=
nil
{
close
(
t
.
outchan
)
break
break
}
}
t
.
outchan
<-
r
t
.
outchan
<-
r
...
@@ -253,7 +250,3 @@ func (t *Terminal) Read() (rune, error) {
...
@@ -253,7 +250,3 @@ func (t *Terminal) Read() (rune, error) {
return
r
,
nil
return
r
,
nil
}
}
func
(
t
*
Terminal
)
Close
()
{
close
(
t
.
outchan
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment