Skip to content

Commit ac395dd

Browse files
authored
A couple of changes/fixes in SshCommand (#1423)
* Send "signal" and set the wait handle on completion always * Make ExitStatus nullable
1 parent bb51335 commit ac395dd

File tree

11 files changed

+327
-521
lines changed

11 files changed

+327
-521
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ dotnet_diagnostic.CA1852.severity = none
688688
# CA1859: Change return type for improved performance
689689
#
690690
# By default, this diagnostic is only reported for private members.
691-
dotnet_code_quality.CA1859.api_surface = all
691+
dotnet_code_quality.CA1859.api_surface = private,internal
692692

693693
# CA2208: Instantiate argument exceptions correctly
694694
# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca2208

src/Renci.SshNet/Channels/ChannelSession.cs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -274,35 +274,6 @@ public bool SendSignalRequest(string signalName)
274274
return true;
275275
}
276276

277-
/// <summary>
278-
/// Sends the exit status request.
279-
/// </summary>
280-
/// <param name="exitStatus">The exit status.</param>
281-
/// <returns>
282-
/// <see langword="true"/> if request was successful; otherwise <see langword="false"/>.
283-
/// </returns>
284-
public bool SendExitStatusRequest(uint exitStatus)
285-
{
286-
SendMessage(new ChannelRequestMessage(RemoteChannelNumber, new ExitStatusRequestInfo(exitStatus)));
287-
return true;
288-
}
289-
290-
/// <summary>
291-
/// Sends the exit signal request.
292-
/// </summary>
293-
/// <param name="signalName">Name of the signal.</param>
294-
/// <param name="coreDumped">if set to <see langword="true"/> [core dumped].</param>
295-
/// <param name="errorMessage">The error message.</param>
296-
/// <param name="language">The language.</param>
297-
/// <returns>
298-
/// <see langword="true"/> if request was successful; otherwise <see langword="false"/>.
299-
/// </returns>
300-
public bool SendExitSignalRequest(string signalName, bool coreDumped, string errorMessage, string language)
301-
{
302-
SendMessage(new ChannelRequestMessage(RemoteChannelNumber, new ExitSignalRequestInfo(signalName, coreDumped, errorMessage, language)));
303-
return true;
304-
}
305-
306277
/// <summary>
307278
/// Sends [email protected] request.
308279
/// </summary>

src/Renci.SshNet/Channels/IChannelSession.cs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -120,27 +120,6 @@ bool SendPseudoTerminalRequest(string environmentVariable,
120120
/// </returns>
121121
bool SendSignalRequest(string signalName);
122122

123-
/// <summary>
124-
/// Sends the exit status request.
125-
/// </summary>
126-
/// <param name="exitStatus">The exit status.</param>
127-
/// <returns>
128-
/// <see langword="true"/> if request was successful; otherwise <see langword="false"/>.
129-
/// </returns>
130-
bool SendExitStatusRequest(uint exitStatus);
131-
132-
/// <summary>
133-
/// Sends the exit signal request.
134-
/// </summary>
135-
/// <param name="signalName">Name of the signal.</param>
136-
/// <param name="coreDumped">if set to <see langword="true"/> [core dumped].</param>
137-
/// <param name="errorMessage">The error message.</param>
138-
/// <param name="language">The language.</param>
139-
/// <returns>
140-
/// <see langword="true"/> if request was successful; otherwise <see langword="false"/>.
141-
/// </returns>
142-
bool SendExitSignalRequest(string signalName, bool coreDumped, string errorMessage, string language);
143-
144123
/// <summary>
145124
/// Sends [email protected] request.
146125
/// </summary>

src/Renci.SshNet/CommandAsyncResult.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,5 @@ internal CommandAsyncResult()
5656
/// true if the operation is complete; otherwise, false.
5757
/// </returns>
5858
public bool IsCompleted { get; internal set; }
59-
60-
/// <summary>
61-
/// Gets or sets a value indicating whether <see cref="SshCommand.EndExecute(IAsyncResult)"/> was already called for this
62-
/// <see cref="CommandAsyncResult"/>.
63-
/// </summary>
64-
/// <returns>
65-
/// <see langword="true"/> if <see cref="SshCommand.EndExecute(IAsyncResult)"/> was already called for this <see cref="CommandAsyncResult"/>;
66-
/// otherwise, <see langword="false"/>.
67-
/// </returns>
68-
internal bool EndCalled { get; set; }
6959
}
7060
}

src/Renci.SshNet/SshClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public SshCommand CreateCommand(string commandText, Encoding encoding)
235235
EnsureSessionIsOpen();
236236

237237
ConnectionInfo.Encoding = encoding;
238-
return new SshCommand(Session, commandText, encoding);
238+
return new SshCommand(Session!, commandText, encoding);
239239
}
240240

241241
/// <summary>

0 commit comments

Comments
 (0)