protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken) { // Inputs var command = Command.Get(context); var sshClient = SSHClient.Get(context); // Set a timeout on the execution var task = ExecuteWithTimeout(context, cancellationToken); if (await Task.WhenAny(task, Task.Delay(TimeoutMS.Get(context), cancellationToken)) != task) { throw new TimeoutException(Resources.Timeout_Error); } if (task.Exception != null) { throw task.Exception; } // Outputs return((ctx) => { ExitCode.Set(ctx, task.Result.ExitStatus); Result.Set(ctx, task.Result.Result); Error.Set(ctx, task.Result.Error); }); }