mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-21 23:20:24 +00:00
ssh commands: improve command ended detection
Sometime we can have this error: read |0: file already closed reading from the command standard error, this means that the command is already finished so we don't need to do nothing. This happen randomically while running the test cases on travis.
This commit is contained in:
parent
20606a0043
commit
ad5436e3f6
3 changed files with 3 additions and 3 deletions
|
@ -5,7 +5,6 @@ os:
|
|||
- osx
|
||||
|
||||
go:
|
||||
- "1.12.x"
|
||||
- "1.13.x"
|
||||
|
||||
env:
|
||||
|
|
|
@ -34,7 +34,7 @@ Regularly the test cases are manually executed and pass on Windows. Other UNIX v
|
|||
|
||||
## Requirements
|
||||
|
||||
- Go 1.12 or higher as build only dependency.
|
||||
- Go 1.13 or higher as build only dependency.
|
||||
- A suitable SQL server or key/value store to use as data provider: PostreSQL 9.4+ or MySQL 5.6+ or SQLite 3.x or bbolt 1.3.x
|
||||
|
||||
## Installation
|
||||
|
|
|
@ -261,7 +261,8 @@ func (c *sshCommand) executeSystemCommand(command systemCommand) error {
|
|||
w, e := transfer.copyFromReaderToWriter(c.connection.channel.Stderr(), stderr, 0)
|
||||
c.connection.Log(logger.LevelDebug, logSenderSSH, "command: %#v, copy from sdterr to remote command ended, written: %v err: %v",
|
||||
c.connection.command, w, e)
|
||||
if e != nil || w > 0 {
|
||||
// os.ErrClosed means that the command is finished so we don't need to to nothing
|
||||
if (e != nil && !errors.Is(e, os.ErrClosed)) || w > 0 {
|
||||
once.Do(closeCmdOnError)
|
||||
}
|
||||
}()
|
||||
|
|
Loading…
Reference in a new issue