@@ -23,8 +23,8 @@ type AdaptedTaskConfig<TInput, TOutput, TPartial = never> = ListrTaskExtras & {
2323 partial ?: ( ctx : Context , partial : TPartial ) => Task ;
2424 } ;
2525 extractInput : ( ctx : Context , listrTask : Listr . ListrTaskWrapper < Context > ) => TInput ;
26- applyOutput ?: ( ctx : Context , output : TOutput ) => void ;
27- applyPartial ?: ( ctx : Context , output : TPartial ) => void ;
26+ applyOutput ?: ( ctx : Context , output : TOutput ) => void | Promise < void > ;
27+ applyPartial ?: ( ctx : Context , output : TPartial ) => void | Promise < void > ;
2828 run : TaskFunction < TInput , TOutput , Deps , TPartial > ;
2929} ;
3030
@@ -41,20 +41,20 @@ const buildDeps = (ctx: Context): Deps => ({
4141 packageJson : ctx . packageJson ,
4242} ) ;
4343
44- function applyAdaptedResult < TInput , TOutput , TPartial > (
44+ async function applyAdaptedResult < TInput , TOutput , TPartial > (
4545 config : AdaptedTaskConfig < TInput , TOutput , TPartial > ,
4646 ctx : Context ,
4747 listrTask : Listr . ListrTaskWrapper < Context > ,
4848 result : TaskResult < TOutput , TPartial >
4949) {
5050 switch ( result . kind ) {
5151 case 'continue' :
52- config . applyOutput ?.( ctx , result . output ) ;
52+ await config . applyOutput ?.( ctx , result . output ) ;
5353 if ( config . transitions ?. success )
5454 transitionTo ( config . transitions . success , true ) ( ctx , listrTask ) ;
5555 return ;
5656 case 'partial' :
57- config . applyPartial ?.( ctx , result . output ) ;
57+ await config . applyPartial ?.( ctx , result . output ) ;
5858 if ( config . transitions ?. partial ) {
5959 const { title, output } = config . transitions . partial ( ctx , result . output ) ;
6060 setTitle ( title , output ) ( ctx , listrTask ) ;
@@ -78,7 +78,7 @@ async function runAdaptedTask<TInput, TOutput, TPartial>(
7878 if ( config . transitions ?. pending ) transitionTo ( config . transitions . pending ) ( ctx , listrTask ) ;
7979 const input = config . extractInput ( ctx , listrTask ) ;
8080 const result = await config . run ( buildDeps ( ctx ) , input ) ;
81- applyAdaptedResult ( config , ctx , listrTask , result ) ;
81+ await applyAdaptedResult ( config , ctx , listrTask , result ) ;
8282}
8383
8484async function runLegacyTask (
0 commit comments