Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return debounce(() => {
if (clear) process.stdout.write(clearScreen);
console.log(brown(`${isMac ? '📦 ' : 'esbox'} ${path.relative(process.cwd(), userScript)}\n`));
if (childProcess) childProcess.kill();
childProcess = execa.spawn('node', [
runner,
'--file', userScript,
'--clear', clear,
'--babelrc', babelrc,
], { cwd, stdio: 'inherit' });
childProcess.on('close', code => {
if (code !== null && code !== 143) {
console.log(brown(`\n${(code === 0 ? tick : cross)} exited with code ${code}`));
if (!clear) console.log();
}
});
return;
}, 10, { maxWait: 1000 });