You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.4 KiB
46 lines
1.4 KiB
import { auth } from "@noderun/hapi-router"
|
|
import { Req, Res, ReturnValue } from "#/global"
|
|
import { exec } from "child_process"
|
|
|
|
export default class Index {
|
|
@auth(false)
|
|
async index(request: Req, h: Res): ReturnValue {
|
|
exec("git pull", (error, stdout, stderr) => {
|
|
if (error) {
|
|
console.log(`error: ${error.message}`)
|
|
return
|
|
}
|
|
if (stderr) {
|
|
console.log(`stderr: ${stderr}`)
|
|
return
|
|
}
|
|
console.log(`stdout: ${stdout}`)
|
|
|
|
exec('pkill -f "node"', (error, stdout, stderr) => {
|
|
if (error) {
|
|
console.log(`error: ${error.message}`)
|
|
return
|
|
}
|
|
if (stderr) {
|
|
console.log(`stderr: ${stderr}`)
|
|
return
|
|
}
|
|
console.log(`stdout: ${stdout}`)
|
|
|
|
exec("pnpm start", (error, stdout, stderr) => {
|
|
if (error) {
|
|
console.log(`error: ${error.message}`)
|
|
return
|
|
}
|
|
if (stderr) {
|
|
console.log(`stderr: ${stderr}`)
|
|
return
|
|
}
|
|
console.log(`stdout: ${stdout}`)
|
|
})
|
|
})
|
|
})
|
|
|
|
return h.response().code(200)
|
|
}
|
|
}
|
|
|