import { spawn , SpawnOptions } from "child_process" ; import { createConsoleLogger } from "./logger" ; param { string } command param { string [ ] } args param { Object } options returns { Promise < number > } export const exec = ( command , args , options ) : Promise < number > => { const runner = spawn ( command , args , { ... options , stdio : "inherit" } ) ; return new Promise ( ( resolve , reject ) : void => { runner . on ( "error" , err => { reject ( err ) ; } ) ; runner . on ( "close" , code => { if ( code !== 0 ) { reject ( code ) ; } const logger = createConsoleLogger ( ) ; logger . log ( `All done ✌️` ) ; resolve ( code ) ; } ) ; } ) ; } ;