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

Remove-SshSession return value is inconsistent. #171

Open
HumanEquivalentUnit opened this issue Sep 5, 2017 · 2 comments · May be fixed by #234
Open

Remove-SshSession return value is inconsistent. #171

HumanEquivalentUnit opened this issue Sep 5, 2017 · 2 comments · May be fixed by #234

Comments

@HumanEquivalentUnit
Copy link

In /Posh-SSH.psm1, line 5 sets up $global:SshSessions as an arraylist.

In Remove-SshSession, lines 148 and 175 call $global:SshSessions.Remove($badsession). An arraylist, .Remove() has no return value, so that suggests Remove-SshSession is not intended to have any return value.

The C# code in PoshSSH/SshModHelper.cs, line 30 overrides the variable and makes it typed a generic list and generic list .Remove() returns bool.

Remove-SshSession returns a bool for whether the session was removed from a List<>. Unless the global variable can stay as an arraylist, then it doesn't. Either way, "list removal" is not related to the SSH session itself, so it seems like an unhelpful return value and is possibly unintentional.

It's documented as having nothing for "Output", but the example usage shows that it has.

@darkoperator
Copy link
Owner

I never fill out the output type of any of the functions.are you creating sessions by hand? they should always be created by the new-sshsession cmdlet that uses the sshmodhelper method.

@HumanEquivalentUnit HumanEquivalentUnit linked a pull request Oct 24, 2018 that will close this issue
@HumanEquivalentUnit
Copy link
Author

I don't know how I was creating them.
Importing the module makea the stores ArrayLists, sshmodhelper casts those into List[SshSession].
I've just suggested a PR so they are created as List[SshSession] from the beginning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants