darkoperator / darkoperator/Posh-SSH

Long running Invoke-SSHCommand throwing timeout exception

Open
#356 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PowerShell
Stars
1.1k
Forks
222
PR merge metrics
No merged PRs in 30d

Description

Command I ran
Invoke-SSHCommand -SSHSession $Session -Command $Command

Behavior I see that this command gets completed correctly but Posh-ssh.psm1 throws issue while parsing output.
shows wrong timeout issue.

Exception Thrown Below

ForEach-Object : Exception calling "EndExecute" with "1" argument(s): "Command 'bash run_lunux_script.sh' has timed out."
At C:\Program Files\WindowsPowerShell\Modules\Posh-SSH\2.2\Posh-SSH.psm1:253 char:17
+                 ForEach-Object {
+                 ~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [ForEach-Object], MethodInvocationException
    + FullyQualifiedErrorId : SshOperationTimeoutException,Microsoft.PowerShell.Commands.ForEachObjectCommand
 

if I run this second time it gets successful.

This is parsing issue i guess

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Posh-SSH.psm1 at line 253 and reproduce the issue using Invoke-SSHCommand with a long-running bash command. Trace how the command output is parsed and how EndExecute handles the timeout, comparing the first and second runs. Done means a successfully completed command no longer produces a misleading timeout exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.