mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-12 17:27:50 +08:00
EvalInteractive now uses a closed channel for input.
This prevents commands like `from-json` from hanging elvish when they appear as the first form of a pipeline.
This commit is contained in:
parent
2fb73f4680
commit
018de2ad8b
|
@ -165,6 +165,9 @@ func (ev *Evaler) Eval(name, text string, n *parse.Chunk, ports []*Port) error {
|
|||
}
|
||||
|
||||
func (ev *Evaler) EvalInteractive(text string, n *parse.Chunk) error {
|
||||
inCh := make(chan Value)
|
||||
close(inCh)
|
||||
|
||||
outCh := make(chan Value, outChanSize)
|
||||
outDone := make(chan struct{})
|
||||
go func() {
|
||||
|
@ -175,7 +178,7 @@ func (ev *Evaler) EvalInteractive(text string, n *parse.Chunk) error {
|
|||
}()
|
||||
|
||||
ports := []*Port{
|
||||
{File: os.Stdin},
|
||||
{File: os.Stdin, Chan: inCh},
|
||||
{File: os.Stdout, Chan: outCh},
|
||||
{File: os.Stderr},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user