(source, options)
| 1 | import { execFile } from 'child_process'; |
| 2 | |
| 3 | export function runModuleInChildProcess(source, options) { |
| 4 | return new Promise(function (resolve, reject) { |
| 5 | execFile( |
| 6 | process.execPath, |
| 7 | ['--input-type=module', '-e', source], |
| 8 | Object.assign({ timeout: 3000, killSignal: 'SIGKILL' }, options), |
| 9 | function (error, stdout, stderr) { |
| 10 | if (error) { |
| 11 | error.stdout = stdout; |
| 12 | error.stderr = stderr; |
| 13 | return reject(error); |
| 14 | } |
| 15 | resolve(stdout); |
| 16 | } |
| 17 | ); |
| 18 | }); |
| 19 | } |
no outgoing calls
no test coverage detected