Closed gescheit closed 7 months ago
If a device closes connection during execution, Channel.read() just silently suppress EOF. It is defined here: https://github.com/scrapli/scrapligo/blob/31a4363eecf3e34ea4e44149cc5a90419f4d3171/channel/read.go#L55 introduced in PR https://github.com/scrapli/scrapligo/pull/109. In this way SendInputB() will wait for command timeout. Not only it is pointless waiting but also it hides real result. For example, if it is reboot command then receiving errTimeoutError is unclear whether the command was executed successfully or not. I think it should be like this:
SendInputB()
reboot
errTimeoutError
if errors.Is(err, io.EOF) { // the underlying transport was closed so just return c.Errs <- err return }
or
c.l.Criticalf( "encountered error reading from transport during channel read loop. error: %s", err, ) c.Errs <- err if errors.Is(err, io.EOF) { return }
hey @gescheit seems reasonable to me -- are you up for a pr for this?
If a device closes connection during execution, Channel.read() just silently suppress EOF. It is defined here: https://github.com/scrapli/scrapligo/blob/31a4363eecf3e34ea4e44149cc5a90419f4d3171/channel/read.go#L55 introduced in PR https://github.com/scrapli/scrapligo/pull/109. In this way
SendInputB()
will wait for command timeout. Not only it is pointless waiting but also it hides real result. For example, if it isreboot
command then receivingerrTimeoutError
is unclear whether the command was executed successfully or not. I think it should be like this:or