22669d70fc
* resolve issue with exit code not bubbling up and inflight tasks swallowing exceptions * update changelog * refacter to reduce and centralize inline program exception flow complexity * quick comments on new pulumi function return type
23 lines
704 B
C#
23 lines
704 B
C#
// Copyright 2016-2021, Pulumi Corporation
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Pulumi.Automation
|
|
{
|
|
internal sealed class PulumiFnInline : PulumiFn
|
|
{
|
|
private readonly Func<CancellationToken, Task<IDictionary<string, object?>>> _program;
|
|
|
|
public PulumiFnInline(Func<CancellationToken, Task<IDictionary<string, object?>>> program)
|
|
{
|
|
this._program = program;
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
internal override Task<int> InvokeAsync(IRunner runner, CancellationToken cancellationToken)
|
|
=> runner.RunAsync(() => this._program(cancellationToken), null);
|
|
}
|
|
}
|