The program/script to execute.
Optionalarguments: readonly string[]Arguments to pass to file on execution.
Optionaloptions: Options<string>A child_process instance, which is enhanced to also be a Promise for a result Object with stdout and stderr properties.
import execa = require('execa');
(async () => {
	const {stdout} = await execa('echo', ['unicorns']);
	console.log(stdout);
	//=> 'unicorns'
	// Cancelling a spawned process
	const subprocess = execa('node');
	setTimeout(() => { spawned.cancel() }, 1000);
	try {
		await subprocess;
	} catch (error) {
		console.log(subprocess.killed); // true
		console.log(error.isCanceled); // true
	}
})();
// Pipe the child process stdout to the current stdout
execa('echo', ['unicorns']).stdout.pipe(process.stdout);
Optionalarguments: readonly string[]Optionaloptions: Options<null>Optionaloptions: Options<string>Optionaloptions: Options<null>
Execute a file.
Think of this as a mix of
child_process.execFileandchild_process.spawn.