import { SpawnResult } from './SpawnResult' ; export function ifExitCodeIsOtherThan ( expectedExitCode , fn ) { return ( result ) => { return result . exitCode !== expectedExitCode ? fn ( result ) : result ; } ; } export function logOutput ( res ) { const prefixWith = ( prefix , multiLineText ) => multiLineText . split ( '\n' ) . map ( line => `[${ prefix }] ${ line }` ) . join ( '\n' ) ; if ( ! ! res . stdout ) { console . info ( prefixWith ( 'out' , res . stdout ) ) ; } if ( ! ! res . stderr ) { console . error ( prefixWith ( 'err' , res . stderr ) ) ; } return res ; }