@@ -285,7 +285,9 @@ async function provision({
285285
286286 const result = await doProvision ( options , providedIdLabels ) ;
287287 const exitCode = result . outcome === 'error' ? 1 : 0 ;
288- console . log ( JSON . stringify ( result ) ) ;
288+ await new Promise < void > ( ( resolve , reject ) => {
289+ process . stdout . write ( JSON . stringify ( result ) + '\n' , err => err ? reject ( err ) : resolve ( ) ) ;
290+ } ) ;
289291 if ( result . outcome === 'success' ) {
290292 await result . finishBackgroundTasks ( ) ;
291293 }
@@ -368,7 +370,9 @@ function setUpHandler(args: SetUpArgs) {
368370async function setUp ( args : SetUpArgs ) {
369371 const result = await doSetUp ( args ) ;
370372 const exitCode = result . outcome === 'error' ? 1 : 0 ;
371- console . log ( JSON . stringify ( result ) ) ;
373+ await new Promise < void > ( ( resolve , reject ) => {
374+ process . stdout . write ( JSON . stringify ( result ) + '\n' , err => err ? reject ( err ) : resolve ( ) ) ;
375+ } ) ;
372376 await result . dispose ( ) ;
373377 process . exit ( exitCode ) ;
374378}
@@ -530,7 +534,9 @@ function buildHandler(args: BuildArgs) {
530534async function build ( args : BuildArgs ) {
531535 const result = await doBuild ( args ) ;
532536 const exitCode = result . outcome === 'error' ? 1 : 0 ;
533- console . log ( JSON . stringify ( result ) ) ;
537+ await new Promise < void > ( ( resolve , reject ) => {
538+ process . stdout . write ( JSON . stringify ( result ) + '\n' , err => err ? reject ( err ) : resolve ( ) ) ;
539+ } ) ;
534540 await result . dispose ( ) ;
535541 process . exit ( exitCode ) ;
536542}
@@ -789,7 +795,9 @@ function runUserCommandsHandler(args: RunUserCommandsArgs) {
789795async function runUserCommands ( args : RunUserCommandsArgs ) {
790796 const result = await doRunUserCommands ( args ) ;
791797 const exitCode = result . outcome === 'error' ? 1 : 0 ;
792- console . log ( JSON . stringify ( result ) ) ;
798+ await new Promise < void > ( ( resolve , reject ) => {
799+ process . stdout . write ( JSON . stringify ( result ) + '\n' , err => err ? reject ( err ) : resolve ( ) ) ;
800+ } ) ;
793801 await result . dispose ( ) ;
794802 process . exit ( exitCode ) ;
795803}
0 commit comments