@@ -478,26 +478,14 @@ public void CancelAsync(bool forceKill = false, int millisecondsTimeout = 500)
478478 }
479479 }
480480
481- private static string ? GetSignalName ( CommandSignal signal )
482- {
483- #if NETCOREAPP
484- return Enum . GetName ( signal ) ;
485- #else
486-
487- // Boxes signal, but Enum.GetName does not have a non-boxing overload prior to .NET Core.
488- return Enum . GetName ( typeof ( CommandSignal ) , signal ) ;
489- #endif
490- }
491-
492481 /// <summary>
493- /// Tries to send a POSIX/ANSI signal to the remote process executing the command, such as SIGINT or SIGTERM .
482+ /// Tries to send a POSIX/ANSI signal to the remote process executing the command, such as SIGTERM or any of the <see cref="CommandSignals"/> .
494483 /// </summary>
495- /// <param name="signal">The signal to send.</param>
484+ /// <param name="signal">The signal to send. See <see cref="CommandSignals"/> for a standard list of signals. </param>
496485 /// <returns>If the signal was sent.</returns>
497- public bool TrySendSignal ( CommandSignal signal )
486+ public bool TrySendSignal ( string signal )
498487 {
499- var signalName = GetSignalName ( signal ) ;
500- if ( signalName is null )
488+ if ( signal is null )
501489 {
502490 return false ;
503491 }
@@ -510,7 +498,7 @@ public bool TrySendSignal(CommandSignal signal)
510498 try
511499 {
512500 // Try to send the cancellation signal.
513- return _channel . SendSignalRequest ( signalName ) ;
501+ return _channel . SendSignalRequest ( signal ) ;
514502 }
515503 catch ( Exception )
516504 {
@@ -522,18 +510,17 @@ public bool TrySendSignal(CommandSignal signal)
522510 }
523511
524512 /// <summary>
525- /// Tries to send a POSIX/ANSI signal to the remote process executing the command, such as SIGINT or SIGTERM .
513+ /// Tries to send a POSIX/ANSI signal to the remote process executing the command, such as SIGTERM or any of the <see cref="CommandSignals"/> .
526514 /// </summary>
527- /// <param name="signal">The signal to send.</param>
515+ /// <param name="signal">The signal to send. See <see cref="CommandSignals"/> for a standard list of signals. </param>
528516 /// <exception cref="ArgumentException">Signal was not a valid CommandSignal.</exception>
529517 /// <exception cref="SshConnectionException">The client is not connected.</exception>
530518 /// <exception cref="SshOperationTimeoutException">The operation timed out.</exception>
531519 /// <exception cref="InvalidOperationException">The size of the packet exceeds the maximum size defined by the protocol.</exception>
532520 /// <exception cref="InvalidOperationException">Command has not been started.</exception>
533- public void SendSignal ( CommandSignal signal )
521+ public void SendSignal ( string signal )
534522 {
535- var signalName = GetSignalName ( signal ) ;
536- if ( signalName is null )
523+ if ( signal is null )
537524 {
538525 throw new ArgumentException ( "Signal was not a valid CommandSignal." ) ;
539526 }
@@ -543,7 +530,7 @@ public void SendSignal(CommandSignal signal)
543530 throw new InvalidOperationException ( "Command has not been started." ) ;
544531 }
545532
546- _ = _channel . SendSignalRequest ( signalName ) ;
533+ _ = _channel . SendSignalRequest ( signal ) ;
547534 }
548535
549536 /// <summary>
0 commit comments