sshnet / sshnet/SSH.NET

Powershell Script started with SshCommand keeps running even after connectivity loss

Open
#893 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
4.4k
Forks
993
Avg merge
9d 21h
Merged PRs (30d)
1

Description

I wanted to start a specific .ps1 file with SSH, so I tried running the script with both SSH.NET and SSH on the Terminal. After testing a little bit I noticed, that after a connectivity loss the Script started with the Terminal drops itself regardless of the progress, on the other Hand with SSH.NET the .ps1 file keeps running even if the connection is dropped.

for SSH.NET I used this Code to start the .ps1-File:

sshc.Connect();
using (var cmd = sshc.CreateCommand("powershell.exe -command C:\\Test.ps1\""))
{
    cmd.Execute();   
}
sshc.Disconnect();

So I want to know why does SSH.NET keeps the script alive and is this a wanted feature

Contributor guide

Open the contributing guide

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 the shown SSH.NET flow using Connect(), CreateCommand(), Execute(), and Disconnect(), then reproduce the behavior by dropping connectivity during C:\Test.ps1. Compare it with the terminal's behavior and determine whether command execution is expected to continue after the SSH connection is lost; document or test the resulting behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.