Switch to GNU timeout-based implementation of SSH timeouts #679
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
As the title says, this PR switches the SSH timeout feature to use the GNU timeout utility (when available) to implement command timeouts instead of using a client-side thread and closing the session, which abandons processes on the server (See #677).
This severely limits the applicability of the feature. First, the timeout utility must be installed. As it is part of gnu coreutils, it is common on Linux and other systems, but not universal, so we must do a check for it. Second, as it is a command wrapper, it does not function properly with any command string that includes pipes. Notably, all InSpec sudo commands include pipes. So, we check for pipes, and do not attempt to do a timeout on any command containing pipes.
This PR retains some functionality while making the feature safe to use. It is a compromise between letting the processes continue to run as on #677, and withdrawing the feature entirely from the SSH transport.
Related Issue
Fixes #677
Types of changes
Checklist: