Better prosody process handling.
This commit is contained in:
parent
63112df21a
commit
faa12de768
@ -122,13 +122,25 @@ async function ensureProsodyRunning (options: RegisterServerOptions): Promise<vo
|
|||||||
|
|
||||||
// launch prosody
|
// launch prosody
|
||||||
logger.info('Going to launch prosody')
|
logger.info('Going to launch prosody')
|
||||||
child_process.exec('prosody', {
|
const prosody = child_process.exec('prosody', {
|
||||||
cwd: filePaths.dir,
|
cwd: filePaths.dir,
|
||||||
env: {
|
env: {
|
||||||
...process.env,
|
...process.env,
|
||||||
PROSODY_CONFIG: filePaths.config
|
PROSODY_CONFIG: filePaths.config
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
prosody.stdout?.on('data', (data) => {
|
||||||
|
logger.debug(`Prosody stdout: ${data as string}`)
|
||||||
|
})
|
||||||
|
prosody.stderr?.on('data', (data) => {
|
||||||
|
logger.error(`Prosody stderr: ${data as string}`)
|
||||||
|
})
|
||||||
|
prosody.on('close', (code) => {
|
||||||
|
logger.info(`Prosody process closed all stdio with code ${code ?? 'null'}`)
|
||||||
|
})
|
||||||
|
prosody.on('exit', (code) => {
|
||||||
|
logger.info(`Prosody process exited with code ${code ?? 'null'}`)
|
||||||
|
})
|
||||||
|
|
||||||
async function sleep (ms: number): Promise<any> {
|
async function sleep (ms: number): Promise<any> {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user