Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Parameter used by Command to allow connection timeouts to complete the command #162

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion command.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (c *Command) slurpAllOutput() (bool, error) {
response, err := c.client.sendRequest(request)
if err != nil {
var errWithTimeout *url.Error
if errors.As(err, &errWithTimeout) && errWithTimeout.Timeout() {
if !c.client.AllowTimeout && errors.As(err, &errWithTimeout) && errWithTimeout.Timeout() {
// Operation timeout because the server didn't respond in time
return false, err
}
Expand Down
1 change: 1 addition & 0 deletions parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ type Parameters struct {
Timeout string
Locale string
EnvelopeSize int
AllowTimeout bool // Allow Commands to finish if connection times out. Useful if the command causes the Host to shut down.
TransportDecorator func() Transporter
Dial func(network, addr string) (net.Conn, error)
}
Expand Down