利用 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 事件
|
// WEBHOOK 处理 GitHub 事件
|
||||||
app.post('/webhook', (req, res) => {
|
app.post('/webhook', (req, res) => {
|
||||||
console.log('WEBHOOK:', req.body)
|
console.log('WEBHOOK:' + new Date().toLocaleString())
|
||||||
return exec('git pull;npm i', (err, stdout, stderr) => {
|
exec('git pull;npm i')
|
||||||
if (err) return res.status(500).json({ error: err })
|
return res.json({ success: true })
|
||||||
return res.json({ stdout, stderr })
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
app.listen(4096, () => console.log('Server started on port 4096'))
|
app.listen(4096, () => console.log('Server started on port 4096'))
|
||||||
|
Loading…
Reference in New Issue
Block a user