Merge pull request #417 from OPNA2608/fix/EPIPE

Deregister prosodyctl interval callback when spawn.stdin disappears
This commit is contained in:
John Livingston 2024-06-12 09:30:50 +02:00 committed by GitHub
commit e7d0cdbb30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View File

@ -13,6 +13,7 @@ TODO: tag conversejs livechat branch, and replace commit ID in build-converse.js
### Minor changes and fixes
* Fix cleanup on channel deletion.
* #416: Deregister prosodyctl interval callback when spawn.stdin disappears.
## 10.0.2

View File

@ -165,6 +165,14 @@ async function prosodyCtl (
options.peertubeHelpers.logger.debug('ProsodyCtl was called in yesMode, writing to standard input.')
spawned.stdin.write('\n')
}, 10)
spawned.stdin.on('close', () => {
options.peertubeHelpers.logger.debug('ProsodyCtl standard input closed, clearing interval.')
clearInterval(yesModeInterval)
})
spawned.stdin.on('error', () => {
options.peertubeHelpers.logger.debug('ProsodyCtl standard input errored, clearing interval.')
clearInterval(yesModeInterval)
})
}
spawned.stdout.on('data', (data) => {
@ -186,7 +194,6 @@ async function prosodyCtl (
// on 'close' and not 'exit', to be sure everything is done
// (else it can cause trouble by cleaning AppImage extract too soon)
spawned.on('close', (code) => {
if (yesModeInterval) { clearInterval(yesModeInterval) }
resolve({
code: code,
stdout: d,