1'use strict'; 2 3require('../../common'); 4const { spawnSync } = require('child_process'); 5 6const four = require('../../common/fixtures') 7 .readSync('async-error.js') 8 .toString() 9 .split('\n') 10 .slice(2, -2) 11 .join('\n'); 12 13const main = `${four} 14 15async function main() { 16 try { 17 await four(); 18 } catch (e) { 19 console.log(e); 20 } 21} 22 23main(); 24`; 25 26// --eval CJS 27{ 28 const child = spawnSync(process.execPath, [ 29 '-e', 30 main, 31 ], { 32 env: { ...process.env }, 33 }); 34 35 if (child.status !== 0) { 36 console.error(child.stderr.toString()); 37 } 38 console.error(child.stdout.toString()); 39} 40