diff --git a/CHANGELOG.md b/CHANGELOG.md index a4a3f58b..6b1f8563 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v2.0.3 + +* Fix Peertube server crash when prosody is not installed + ## v2.0.2 * Trying to fix dependencies installation problems diff --git a/server/lib/prosody/ctl.ts b/server/lib/prosody/ctl.ts index 6b78cc6e..ecb46dbc 100644 --- a/server/lib/prosody/ctl.ts +++ b/server/lib/prosody/ctl.ts @@ -17,7 +17,7 @@ async function prosodyCtl (options: RegisterServerOptions, command: string): Pro if (!/^\w+$/.test(command)) { throw new Error(`Invalid prosodyctl command '${command}'`) } - return new Promise((resolve) => { + return new Promise((resolve, reject) => { let d: string = '' let e: string = '' let m: string = '' @@ -41,6 +41,7 @@ async function prosodyCtl (options: RegisterServerOptions, command: string): Pro e += data as string m += data as string }) + spawned.on('error', reject) spawned.on('exit', (code) => { resolve({ code: code, @@ -172,6 +173,9 @@ async function ensureProsodyRunning (options: RegisterServerOptions): Promise { logger.error(`Prosody stderr: ${data as string}`) }) + prosody.on('error', (error) => { + logger.error(`Prosody exec error: ${JSON.stringify(error)}`) + }) prosody.on('close', (code) => { logger.info(`Prosody process closed all stdio with code ${code ?? 'null'}`) })