(child, processFile)
| 111 | }; |
| 112 | |
| 113 | async function initChild(child, processFile) { |
| 114 | const onComplete = new Promise((resolve, reject) => { |
| 115 | const onMessageHandler = msg => { |
| 116 | if (msg.cmd === 'init-complete') { |
| 117 | resolve(); |
| 118 | } else if (msg.cmd === 'error') { |
| 119 | reject(msg.error); |
| 120 | } |
| 121 | child.off('message', onMessageHandler); |
| 122 | }; |
| 123 | child.on('message', onMessageHandler); |
| 124 | }); |
| 125 | |
| 126 | await new Promise(resolve => |
| 127 | child.send({ cmd: 'init', value: processFile }, resolve) |
| 128 | ); |
| 129 | await onComplete; |
| 130 | } |
| 131 | function ChildPoolSingleton(isSharedChildPool = false) { |
| 132 | if (isSharedChildPool === false) { |
| 133 | return new ChildPool(); |
no test coverage detected
searching dependent graphs…