@@ -81,6 +81,7 @@ import { fileExecutionEngine } from "../../execute/engine.ts";
81
81
import { projectContextForDirectory } from "../../project/project-context.ts" ;
82
82
import { ProjectType } from "../../project/types/types.ts" ;
83
83
import { ProjectConfig as ProjectConfig_Project } from "../../resources/types/schema-types.ts" ;
84
+ import { RunHandlerOptions } from "../../core/run/types.ts" ;
84
85
85
86
const noMutationValidations = (
86
87
projType : ProjectType ,
@@ -976,35 +977,38 @@ async function runScripts(
976
977
env [ "QUARTO_PROJECT_SCRIPT_PROGRESS" ] = "1" ;
977
978
}
978
979
979
- const handler = handlerForScript ( script ) ;
980
- if ( handler ) {
981
- const input = Deno . env . get ( "QUARTO_USE_FILE_FOR_PROJECT_INPUT_FILES" ) ;
982
- const output = Deno . env . get ( "QUARTO_USE_FILE_FOR_PROJECT_OUTPUT_FILES" ) ;
983
- if ( input ) {
984
- env [ "QUARTO_USE_FILE_FOR_PROJECT_INPUT_FILES" ] = input ;
985
- }
986
- if ( output ) {
987
- env [ "QUARTO_USE_FILE_FOR_PROJECT_OUTPUT_FILES" ] = output ;
988
- }
980
+ const handler = handlerForScript ( script ) ?? {
981
+ run : async (
982
+ script : string ,
983
+ args : string [ ] ,
984
+ _stdin ?: string ,
985
+ options ?: RunHandlerOptions ,
986
+ ) => {
987
+ return await execProcess ( {
988
+ cmd : [ script , ...args ] ,
989
+ cwd : options ?. cwd ,
990
+ stdout : options ?. stdout ,
991
+ env : options ?. env ,
992
+ } ) ;
993
+ } ,
994
+ } ;
989
995
990
- const result = await handler . run ( script , args . splice ( 1 ) , undefined , {
991
- cwd : projDir ,
992
- stdout : quiet ? "piped" : "inherit" ,
993
- env,
994
- } ) ;
995
- if ( ! result . success ) {
996
- throw new Error ( ) ;
997
- }
998
- } else {
999
- const result = await execProcess ( {
1000
- cmd : args ,
1001
- cwd : projDir ,
1002
- stdout : quiet ? "piped" : "inherit" ,
1003
- env,
1004
- } ) ;
1005
- if ( ! result . success ) {
1006
- throw new Error ( ) ;
1007
- }
996
+ const input = Deno . env . get ( "QUARTO_USE_FILE_FOR_PROJECT_INPUT_FILES" ) ;
997
+ const output = Deno . env . get ( "QUARTO_USE_FILE_FOR_PROJECT_OUTPUT_FILES" ) ;
998
+ if ( input ) {
999
+ env [ "QUARTO_USE_FILE_FOR_PROJECT_INPUT_FILES" ] = input ;
1000
+ }
1001
+ if ( output ) {
1002
+ env [ "QUARTO_USE_FILE_FOR_PROJECT_OUTPUT_FILES" ] = output ;
1003
+ }
1004
+
1005
+ const result = await handler . run ( script , args . slice ( 1 ) , undefined , {
1006
+ cwd : projDir ,
1007
+ stdout : quiet ? "piped" : "inherit" ,
1008
+ env,
1009
+ } ) ;
1010
+ if ( ! result . success ) {
1011
+ throw new Error ( ) ;
1008
1012
}
1009
1013
}
1010
1014
if ( scripts . length > 0 ) {
0 commit comments