利用 exec 的异步防止重启造成的错误日志
This commit is contained in:
parent
24b5ab2fce
commit
ca57791d51
8
index.js
8
index.js
@ -120,11 +120,9 @@ app.ws('/entanglement', (ws, req) => {
|
||||
|
||||
// WEBHOOK 处理 GitHub 事件
|
||||
app.post('/webhook', (req, res) => {
|
||||
console.log('WEBHOOK:', req.body)
|
||||
return exec('git pull;npm i', (err, stdout, stderr) => {
|
||||
if (err) return res.status(500).json({ error: err })
|
||||
return res.json({ stdout, stderr })
|
||||
})
|
||||
console.log('WEBHOOK:' + new Date().toLocaleString())
|
||||
exec('git pull;npm i')
|
||||
return res.json({ success: true })
|
||||
})
|
||||
|
||||
app.listen(4096, () => console.log('Server started on port 4096'))
|
||||
|
Loading…
Reference in New Issue
Block a user