diff --git a/src/core/Akka/Actor/PipeToSupport.cs b/src/core/Akka/Actor/PipeToSupport.cs index 3fd3a1ddbc3..aee24df3625 100644 --- a/src/core/Akka/Actor/PipeToSupport.cs +++ b/src/core/Akka/Actor/PipeToSupport.cs @@ -24,12 +24,26 @@ public static Task PipeTo(this Task taskToPipe, ICanTell recipient, IActor sender = sender ?? ActorRefs.NoSender; return taskToPipe.ContinueWith(tresult => { - if(tresult.IsCanceled || tresult.IsFaulted) + if (tresult.IsCanceled || tresult.IsFaulted) recipient.Tell(new Status.Failure(tresult.Exception), sender); else if (tresult.IsCompleted) recipient.Tell(tresult.Result, sender); }, TaskContinuationOptions.ExecuteSynchronously & TaskContinuationOptions.AttachedToParent); } + + /// + /// Pipes the output of a Task directly to the 's mailbox once + /// the task completes. As this task has no result, only exceptions will be piped to the + /// + public static Task PipeTo(this Task taskToPipe, ICanTell recipient, IActorRef sender = null) + { + sender = sender ?? ActorRefs.NoSender; + return taskToPipe.ContinueWith(tresult => + { + if (tresult.IsCanceled || tresult.IsFaulted) + recipient.Tell(new Status.Failure(tresult.Exception), sender); + }, TaskContinuationOptions.ExecuteSynchronously & TaskContinuationOptions.AttachedToParent); + } } }