blob: 5a92ab8b1f83c691c83d9606e427eaffd6c101c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
import { WPTRunner } from './runner/runner.mjs'
import { join } from 'path'
import { fileURLToPath } from 'url'
import { fork } from 'child_process'
import { on } from 'events'
const serverPath = fileURLToPath(join(import.meta.url, '../server/server.mjs'))
const child = fork(serverPath, [], {
stdio: ['pipe', 'pipe', 'pipe', 'ipc']
})
child.on('exit', (code) => process.exit(code))
for await (const [message] of on(child, 'message')) {
if (message.server) {
const runner = new WPTRunner('FileAPI', message.server)
runner.run()
runner.once('completion', () => {
if (child.connected) {
child.send('shutdown')
}
})
}
}
|