mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-13 18:07:51 +08:00
parent
227f9a8d2a
commit
f3c82a65b0
|
@ -102,6 +102,7 @@ func (cp *compiler) pipeline(n *parse.Pipeline) Op {
|
|||
thisError := &errors[i]
|
||||
go func() {
|
||||
(*thisError).inner = newEc.PEval(thisOp)
|
||||
// Logger.Printf("closing ports of %s", newEc.context)
|
||||
ClosePorts(newEc.ports)
|
||||
finished <- true
|
||||
}()
|
||||
|
@ -328,6 +329,7 @@ func (cp *compiler) redir(n *parse.Redir) Op {
|
|||
}
|
||||
|
||||
ec.growPorts(dst + 1)
|
||||
// Logger.Printf("closing old port %d of %s", dst, ec.context)
|
||||
ec.ports[dst].Close()
|
||||
|
||||
srcMust := ec.must(srcOp(ec), "redirection source", pSrc)
|
||||
|
|
|
@ -89,7 +89,6 @@ func (c *Closure) Call(ec *evalCtx, args []Value) {
|
|||
// TODO(xiaq): Also change ec.name and ec.text since the closure being
|
||||
// called can come from another source.
|
||||
|
||||
ClosePorts(ec.ports)
|
||||
c.Op(ec)
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ func (p *Port) Close() {
|
|||
p.File.Close()
|
||||
}
|
||||
if p.CloseChan {
|
||||
// Logger.Printf("closing channel %v", p.Chan)
|
||||
close(p.Chan)
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +27,7 @@ func (p *Port) Close() {
|
|||
// closePorts closes a list of Ports.
|
||||
func ClosePorts(ports []*Port) {
|
||||
for _, port := range ports {
|
||||
// Logger.Printf("closing port %d", i)
|
||||
port.Close()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user