master
pan 4 years ago
parent aee534fc8a
commit 28ecf02db9
  1. 29
      routes/index.js

@ -8,20 +8,25 @@ router.post('/server', function(req, res, next) {
const updated_at=req.body.repository.updated_at const updated_at=req.body.repository.updated_at
console.info('调用自动部署命令') console.info('调用自动部署命令')
const spawnObj = spawn('updateRisk', ['RiskCloudMock'], {encoding: 'utf-8'});
spawnObj.stdout.on('data', function(chunk) { const promise = new Promise((resolve, reject) => {
console.log(chunk.toString()); const spawnObj = spawn('updateRisk', ['RiskCloudMock'], {encoding: 'utf-8'});
}); spawnObj.stdout.on('data', function(chunk) {
spawnObj.stderr.on('data', (data) => { console.log(chunk.toString());
console.error(data); });
}); spawnObj.stderr.on('data', (data) => {
spawnObj.on('close', function(code) { console.error(data);
console.log('close code : ' + code); });
}) spawnObj.on('close', function(code) {
spawnObj.on('exit', (code) => { console.log('close code : ' + code);
console.log('exit code : ' + code); })
spawnObj.on('exit', (code) => {
console.log('exit code : ' + code);
resolve(true)
})
}) })
res.json({message:`仓库代码${req.body.repository.ssh_url}部署中`}) res.json({message:`仓库代码${req.body.repository.ssh_url}部署中`})
}); });

Loading…
Cancel
Save