Fix Peertube server crash when prosody is not installed.
This commit is contained in:
parent
bb1adf3fa9
commit
079332733a
@ -1,5 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## v2.0.3
|
||||||
|
|
||||||
|
* Fix Peertube server crash when prosody is not installed
|
||||||
|
|
||||||
## v2.0.2
|
## v2.0.2
|
||||||
|
|
||||||
* Trying to fix dependencies installation problems
|
* Trying to fix dependencies installation problems
|
||||||
|
@ -17,7 +17,7 @@ async function prosodyCtl (options: RegisterServerOptions, command: string): Pro
|
|||||||
if (!/^\w+$/.test(command)) {
|
if (!/^\w+$/.test(command)) {
|
||||||
throw new Error(`Invalid prosodyctl command '${command}'`)
|
throw new Error(`Invalid prosodyctl command '${command}'`)
|
||||||
}
|
}
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve, reject) => {
|
||||||
let d: string = ''
|
let d: string = ''
|
||||||
let e: string = ''
|
let e: string = ''
|
||||||
let m: string = ''
|
let m: string = ''
|
||||||
@ -41,6 +41,7 @@ async function prosodyCtl (options: RegisterServerOptions, command: string): Pro
|
|||||||
e += data as string
|
e += data as string
|
||||||
m += data as string
|
m += data as string
|
||||||
})
|
})
|
||||||
|
spawned.on('error', reject)
|
||||||
spawned.on('exit', (code) => {
|
spawned.on('exit', (code) => {
|
||||||
resolve({
|
resolve({
|
||||||
code: code,
|
code: code,
|
||||||
@ -172,6 +173,9 @@ async function ensureProsodyRunning (options: RegisterServerOptions): Promise<vo
|
|||||||
prosody.stderr?.on('data', (data) => {
|
prosody.stderr?.on('data', (data) => {
|
||||||
logger.error(`Prosody stderr: ${data as string}`)
|
logger.error(`Prosody stderr: ${data as string}`)
|
||||||
})
|
})
|
||||||
|
prosody.on('error', (error) => {
|
||||||
|
logger.error(`Prosody exec error: ${JSON.stringify(error)}`)
|
||||||
|
})
|
||||||
prosody.on('close', (code) => {
|
prosody.on('close', (code) => {
|
||||||
logger.info(`Prosody process closed all stdio with code ${code ?? 'null'}`)
|
logger.info(`Prosody process closed all stdio with code ${code ?? 'null'}`)
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user