-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.js
32 lines (27 loc) · 895 Bytes
/
run.js
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
27
28
29
30
31
32
const { spawn } = require('child_process')
const { readFileSync } = require('fs')
let db = process.argv[2]
let config = process.argv[3]
let mapping = spawn("node", ["mappings.js", config, db])
let configdata = readFileSync(config)
let parsed = JSON.parse(configdata)
mapping.stdout.on('data',
data => {
console.log(data.toString())
})
mapping.stderr.on('data',
data => {
console.log(data.toString())
})
mapping.on('close', _ => {
parsed.forEach( ({id}) => {
let entry = spawn("node",["entry.js", id, db]);
entry.stdout.on('data', data => console.log(data.toString()))
entry.stderr.on('data', data => console.log(data.toString()))
})
})
let f = function({stdout, stderr}) {
stdout.on('data', data => console.log(data.toString()))
stderr.on('data', data => console.log(data.toString()))
}
f(spawn("node",["src/index.js", config, db]))