-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathserver.js
51 lines (49 loc) · 1.19 KB
/
server.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* @Author: jing.chen
* @Date: 2020-10-30 09:49:36
* @LastEditors: jing.chen
* @LastEditTime: 2020-11-11 11:08:39
* @Description:
*/
const async = require('async');
const exec = require('child_process').exec;
function runServe (path, callback) {
let dev = exec(
`cd ${path} && ls && npm run serve`,
{
detached: true,
maxBuffer:16*1024*1024
},
function (error, stdout, stderr) {
if (error) {
console.log(error.stack);
console.log('Error code: '+error.code);
console.log('Signal received: '+error.signal);
}
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
})
dev.stdout.pipe(process.stdout)
// dev.stderr.pipe(process.stderr)
}
async.series([
cb => {
async.parallel([
callback => {
console.log('now is run main-app')
runServe('main-app/', callback)
},
callback => {
console.log('now is run child01')
runServe('child-app01/', callback)
},
callback => {
console.log('now is run child02')
runServe('child-app02/', callback)
}
], cb)
}
], (err, results) => {
if (err) throw err;
console.log(results)
})