packages/liferay-theme-tasks/theme/lib/theme_finder.js
/**
 * Wrapper for spawn.sync that fails on any error.
 */
Wrapper for spawn.sync that fails on any error.
Wrapper for spawn . sync that fails on any error .
function run(command, args) {
	const getDescription = () => `${command} ${args.join(' ')}`;
	let error;
	const results = spawn.sync(command, args);
	if (results.error) {
		error = new Error(
			`Command \`${getDescription()}\` encountered an error: ${
				results.error
			}`
		);
	} else if (results.signal) {
		error = new Error(
			`Command \`${getDescription()}\` exited due to signal: ${
				results.signal
			}`
		);
	} else if (results.status) {
		error = new Error(
			`Command \`${getDescription()}\` exited with status: ${
				results.status
			}`
		);
	}
	if (error) {
		if (results.stdout) {
			console.log(results.stdout.toString());
		}
		if (results.stderr) {
			console.log(results.stderr.toString());
		}
		throw error;
	}
}
function run ( command , args ) { const getDescription = ( ) => ` ${ command } ${ args . join ( ' ' ) } ` ; let error ; const results = spawn . sync ( command , args ) ; if ( results . error ) { error = new Error ( ` \` ${ getDescription ( ) } \` ${ results . error } ` ) ; } else if ( results . signal ) { error = new Error ( ` \` ${ getDescription ( ) } \` ${ results . signal } ` ) ; } else if ( results . status ) { error = new Error ( ` \` ${ getDescription ( ) } \` ${ results . status } ` ) ; } if ( error ) { if ( results . stdout ) { console . log ( results . stdout . toString ( ) ) ; } if ( results . stderr ) { console . log ( results . stderr . toString ( ) ) ; } throw error ; } }
Wrapper for spawn.sync that fails on any error.
Wrapper for spawn . sync that fails on any error .
// eslint-disable-next-line no-console // eslint-disable-next-line no-console